Opened 11 years ago

Closed 11 years ago

#5920 closed enhancement (fixed)

Play back Trailers for films in MythVideo

Reported by: robert.mcnamara@… Owned by: Anduin Withers
Priority: minor Milestone: unknown
Component: mythvideo Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This patch adds a new button to the Context Menu in MythVideo?, "Play Trailer." Simply add a trailer file as $VideoFilename?.trailer (eg "The Fifth Element.avi.trailer") in the same directory as the movie file. You do not need to add a .trailer file extension (and in fact you should not).

Kinda fun.

Attachments (10)

trailerplayback.diff (2.0 KB) - added by robert.mcnamara@… 11 years ago.
Patch to add trailer playback button/functionality.
trailerplayback.2.diff (2.4 KB) - added by robert.mcnamara@… 11 years ago.
Second version, ask to play trailer only if one exists.
trailerplayback.3.diff (2.1 KB) - added by robert.mcnamara@… 11 years ago.
Fixes a segfault and removes superfluous debug info
trailerplayback.4.diff (11.4 KB) - added by robert.mcnamara@… 11 years ago.
Trailer now pulled from the DB (Call the file whatever you like)
trailerplayback.5.diff (18.6 KB) - added by robert.mcnamara@… 11 years ago.
Adds GUI. DB changes coming in seperate patch.
trailerplayback.6.diff (19.5 KB) - added by robert.mcnamara@… 11 years ago.
Integrates DB changes in the correct file, removes a commented line.
trailerplayback.7.diff (19.5 KB) - added by robert.mcnamara@… 11 years ago.
Updates trailer playback patch to account for new DB changes
trailerpatch.diff (23.8 KB) - added by robert.mcnamara@… 11 years ago.
New and hopefully final version
trailerpatch.2.diff (23.4 KB) - added by robert.mcnamara@… 11 years ago.
Little whitespace fix
trailers.diff (23.5 KB) - added by robert.mcnamara@… 11 years ago.
Updates patch for after 19361

Download all attachments as: .zip

Change History (21)

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.diff added

Patch to add trailer playback button/functionality.

comment:1 Changed 11 years ago by robert.mcnamara@…

Gah, upon rereading I realize how unclear that sounded. I meant that you need not add .trailer as a valid file type in Mythfrontend. The trailer in your mythvideo directory must indeed be named nameofmovie.ext.trailer.

comment:2 Changed 11 years ago by wstewart@…

Looks interesting but two comments/suggestions. If possible "Play tailer" button should only be added if there is actually a trailer file present.

Second perhaps trailers should be in a separate directory and perhaps identified by a videometadata database field.

comment:3 Changed 11 years ago by robert.mcnamara@…

Second version, will only present the option to view the trailer if the .trailer file exists. I tend to disagree with the need for yet another configuration option/DB entry, though. Myth has, IMO, too many as it is. There's precedent for a behaviour like with with folder.png/jpg.

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.2.diff added

Second version, ask to play trailer only if one exists.

comment:4 in reply to:  2 Changed 11 years ago by dekarl@…

Replying to wstewart@hgrace.com:

Second perhaps trailers should be in a separate directory and perhaps identified by a videometadata database field.

Keeping it in the metadata sounds good. As long as it enables us to have many trailers per movie. A nice feature would be "watch randomized list of all trailers" where upon seeing a movie you like you just hit play and the movie starts. (aka lazy sunday afternoon mode)

Replying to robert.mcnamara@gmail.com:

I tend to disagree with the need for yet another configuration option/DB entry, though.

I understood that there should be some metadatafield stating "this movie is a trailer for movie xyz". Similar to the "play movie xyz after this one has finished" for linking parts together. Lets you "show just movies, no trailers for selection" or "play all trailers for a given movie if a users idles on the movie details page".

comment:5 Changed 11 years ago by wstewart@…

What would be really cool is if the trailer played in a small video on the video info screen (ala recording screen video preview). I know that there are some mythui changes coming that would be inline with providing support for this.

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.3.diff added

Fixes a segfault and removes superfluous debug info

comment:6 Changed 11 years ago by robert.mcnamara@…

Third version of the patch, fixes a segfault caused when calling up the context menu with a directory as the active object. Removes debug message, simplifies a line or two.

Please keep discussion and suggestions on the -dev list where they belong. Because I am implementing a patch for a functionality I wanted, I am implementing it for the use case that works best for me. I too can envisage exciting possibilities for this functionality, but I do not care to implement what I see as superfluous database use at this early stage. Yes, using the video widget that is coming from Mythtv-vid presents exciting possibilities. Yes, a different (seperate) functionality leveraging this one that randomizes "x" number of trailers before a film would be a fun option (and here I could see a DB value for "x" to set the number of trailers to play before a film). But it is premature to talk of using widgets that don't exist in trunk, and I am doing this for my own enjoyment-- and will continue to do so in a way that is fun (and works) for me.

Thanks, please try it out and I'll happily chat about it on the list.

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.4.diff added

Trailer now pulled from the DB (Call the file whatever you like)

comment:7 Changed 11 years ago by robert.mcnamara@…

Fourth version. Moves the trailer into the metadata and updates queries appropriately. This version requires that you add a column called "trailer" to videometadata (I'm avoiding patching dbcheck.cpp for the moment). No GUI for the trailer at the moment, requires that you manually edit it in to the DB. Still checks for the existence of the trailer before presenting the option. Queries may need to be reordered a bit for line length/neatness, but otherwise should function properly.

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.5.diff added

Adds GUI. DB changes coming in seperate patch.

comment:8 Changed 11 years ago by anonymous

Okay, GUI added in the latest version of the patch. This DB update is also necessary and patche's Myth's dbcheck.cpp:

Index: dbcheck.cpp
===================================================================
--- dbcheck.cpp	(revision 19122)
+++ dbcheck.cpp	(working copy)
@@ -18,7 +18,7 @@
 #define MINIMUM_DBMS_VERSION 5,0,15
 
 /// This is the DB schema version expected by the running MythTV instance.
-const QString currentDatabaseVersion = "1223";
+const QString currentDatabaseVersion = "1224";
 
 static bool UpdateDBVersionNumber(const QString &newnumber);
 static bool performActualUpdate(
@@ -4302,6 +4302,16 @@
             return false;
     }
 
+ if (dbver == "1223")
+    {
+        const char *updates[] = {
+"ALTER TABLE `videometadata` ADD `trailer` TEXT NOT NULL ;",
+NULL
+};
+if (!performActualUpdate(updates, "1224", dbver))
+            return false;
+    }
+
     return true;
 }

So, Now works from the DB, has a GUI, and has the DB updates. I advise making the DB updates yourself until this hits trunk, though.

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.6.diff added

Integrates DB changes in the correct file, removes a commented line.

comment:9 Changed 11 years ago by Dibblah

Status: newassigned

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerplayback.7.diff added

Updates trailer playback patch to account for new DB changes

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerpatch.diff added

New and hopefully final version

comment:10 Changed 11 years ago by robert.mcnamara@…

New and hopefully final version of the trailer patch. It patch does the following:

*Adds a seventh page to Video Settings->General including the settings:

  • Trailer Directory
  • Enable Random Trailers
  • Number of trailers to play

*If Enable Random Trailers is on, the context menu for each video gets a new button called "Watch With Trailers." Selecting this will play the user-selected number of trailers before the movie begins. This is very very cool looking and works smoothly.

*A new field is added to the Edit Metadata screen allowing for each movie to have its own trailer associated with it. Associating a single trailer with a movie adds the context button "Play Trailer" which allows one to play the trailer for a specific movie.

*Updates database schema appropriately.

I hope that someone can look at this soon with an eye to committing it. I can't think how I can take this any further at the moment, and I think the code is fairly clean. It also works very well and is a feature I think people would enjoy.

Changed 11 years ago by robert.mcnamara@…

Attachment: trailerpatch.2.diff added

Little whitespace fix

Changed 11 years ago by robert.mcnamara@…

Attachment: trailers.diff added

Updates patch for after 19361

comment:11 Changed 11 years ago by Anduin Withers

Resolution: fixed
Status: assignedclosed

(In [19441]) Closes #5920

Slightly reworks a patch from Robert McNamara? to add:

  • A Watch With Trailers button that will play n random trailers before playing a video.
  • A Watch Trailer button to watch a trailer associated with a specific video.

Similar patches adding random background simlish and some sort of MythTV First Look will be rejected.

Note: See TracTickets for help on using tickets.