[mythtv-theming] coverfile vs screenshot

paul10 at planar.id.au paul10 at planar.id.au
Wed Aug 19 00:41:40 UTC 2009


> It should be the HOME of the user running mythfrontend. Note that some
> distros have start scripts that change the HOME environment variable to
> refer to some directory that's not in /home before starting myth apps,
> so really, you'll have to check out how your mythfrontend is started to
> know for sure where it is. 

OK, worked it out.  For some reason it's going into /tmp, that doesn't
appear to be controlled by my distribution as I'm running svn.  Anyway, it
works and that's what matters.  

I've built a script that takes that screenshot and puts it into the right
directory on my server, and updates my database to have a link to it.  The
workflow here is:
  - play the video, take one or more screenshots
  - alt+tab to nautilus, look at the images in /tmp to work out which one I
like
  - delete the ones I don't like from /tmp, the remaining one I drag onto
gimp to edit
  - crop it to the bits I want, close + save
  - alt+tab to console, run my script: ./setup_screenshot.pl "portion of
video filename"

It's pretty quick, and I'm very happy with the results.  One day it would
be nice to integrate something like this into mythvideo, but then again,
there may be some new metadata that comes along that makes it redundant.

If anyone is interested in doing something like this, the script looks
something like this:
  #!/usr/bin/perl

  my $video_name = shift;

  my $id_count = `mysql -u root mythconverg -e \"select count(intid) from
videometadata where filename like \\\"%$video_name%\\\";\" --raw --batch
--skip-column-names`;
  print "mysql -u root mythconverg -e \"select count(intid) from
videometadata where filename like \\\"%$video_name%\\\";\" --raw --batch
--skip-column-names";

  if ($id_count != "1") {
    die "There is more than one, or no, video with that name";
    }

  my $database_id = `mysql -u root mythconverg -e \"select intid from
videometadata where filename like \\\"%$video_name%\\\";\" --raw --batch
--skip-column-names`;
  my $filename = `mysql -u root mythconverg -e \"select filename from
videometadata where intid = $database_id;\" --raw --batch
--skip-column-names`;

  $filename =~ /\/usr\/share\/mythtv\/server\/mythvideo\/Music
Videos\/(.*)\.avi/;

  $filename = "/usr/share/mythtv/server/mythvideo/screenshots/" . $1 .
".png";

  `mv /tmp/myth-sc* \"$filename\"`;

  print "mysql -u root mythconverg -e \"update videometadata set coverfile
= \"$filename\" where intid = $database_id;";
  `mysql -u root mythconverg -e \"update videometadata set coverfile =
\\\"$filename\\\" where intid = $database_id;\"`;

You'd obviously need to update some of the paths etc if you wanted to use
this on your own setup.


Thanks for the assistance,

Paul



More information about the mythtv-theming mailing list