Author Topic: Automating import of video files with meta data  (Read 4532 times)

Greg

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Automating import of video files with meta data
« on: October 30, 2007, 04:01:10 pm »
I have a bunch of video files with associated metadata in XML format.  I want to import these files into LMCE so that the metadata is visible and can be used for sorting.

I'd like to create a script to automate the process.
Any suggestions on where to start?  Should I just manipulate the database directly, or are there better ways?  I notice that MythTV recordings are added to the database using the SaveMythRecording.sh script, which in turn simply calls MessageSend.  Could I do it by calling MessageSend?  Are the message documented somewhere?

Thanks for any and all help.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Automating import of video files with meta data
« Reply #1 on: October 30, 2007, 05:55:50 pm »
Hi,

I'm willing to help, but don't know much about it. Maybe for a start we can start parsing that message being sent. This could probably help a lot of other users with tons of video files and meta data in some sort of custom format.

You can find more info about messages on the wiki :

http://wiki.linuxmce.org/index.php/MessageSend

There are also other examples of using MessageSend, maybe the most related is current work on photoscreen saver :

http://wiki.linuxmce.org/index.php/Use_my_own_pictures_in_the_Screen_Saver

Let's start discussing it, I'm sure others will jump in... For a start some Perl or bash script that does something would be nice.... I'm also tired of seeing empty rectangles on GUI...  :)

Regards,

Bulek.


Thanks in advance,

regards,

Bulek.

Greg

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Re: Automating import of video files with meta data
« Reply #2 on: October 30, 2007, 07:33:00 pm »
Looks like there's some hope for accomplishing it with SendMessage.  Unfortunately, there isn't much detail about all the parameters to SendMessage.  A lot of them appear to be numeric, and I haven't found a reference for what they all mean.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Automating import of video files with meta data
« Reply #3 on: October 30, 2007, 07:53:03 pm »
Looks like there's some hope for accomplishing it with SendMessage.  Unfortunately, there isn't much detail about all the parameters to SendMessage.  A lot of them appear to be numeric, and I haven't found a reference for what they all mean.
I'm not at home. Could you post few messages to disect them ?

Perhaps you already know, but you can get valuable info also from web-admin page (it's under DCE somewhere)....

Guys figured out the way photoscreen does it, maybe we can easily do this as well....

Let's start doing it, I'll try to contact guys and find additional info....


Regards,

Bulek.
Thanks in advance,

regards,

Bulek.

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: Automating import of video files with meta data
« Reply #4 on: October 30, 2007, 11:42:31 pm »
Hi,

The numbers that you pass are pretty straightforward.

Have a look at http://wiki.linuxmce.org/index.php/MessageSend

Basically you send to a device number, keep in mind that everything is a device which is related heirarchically in a tree structure with the DCREROUTER as the root node. Commands will usually pass down through the tree until they are consumed/handled.

The parameters are paried values with the parameter number and then the value.

In the web admin, under Configuration->Commands or something like that (Sorry I am not at home at teh moment) you can find all the commands. If you look further into them you will be able to discover the parameters, their number and their direction.

HTH
Darren

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Automating import of video files with meta data
« Reply #5 on: October 30, 2007, 11:53:36 pm »
Hi,

I have taken a closer look.

Message is an event nr 69, aka  "MythTV Show Recorded"

and 3 parameters follow :

DateTime
#57   The date we started recording    Edit

MythTV ChannelID
#29   the channel id    Edit

Name
#35   The filename    Edit
Delete

It seems that proper plugin takes this info and puts it into sql database.... We should figure out what exactly is being done with those files and then write a script to mimic such behaviour....

HTH,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

Greg

  • Regular Poster
  • **
  • Posts: 29
    • View Profile
Re: Automating import of video files with meta data
« Reply #6 on: October 31, 2007, 09:19:51 pm »
I've also done some investigating.

I found a number of MessageSend commands that look useful:

CommandParametersReturnsComment
AddMediaAttribute (391)attributeType (122)
fileID (145)
value (5)
attributeID (123)
GetAttribute (393)attributeID (123)text (5)
GetIDFromFileName (819)fileName (13)fileID (145)
SetMediaAttributeText (392)attributeID (123)
text (5)
GetAttributesForMediafilename (13)text (5)A tab delimited list of attributes: Attribute type \t Name \t type...

The AttributeTypes ( I figured these about by running the query "select PK_AttributeType,Description from AttributeType;") are:

IDDescription
1Director
2Performer
3Album
5Track
6ASIN
7CDDB
8Genre
9Ref #
10Channel
11Episode
12Program
13Title
14Disc ID
15Conductor
16Composer/Writer
17Studio
18Rating
19Release Date
20Website
21Chapter
22Encoding
23Format
24Aspect Ratio(s)
25Audio Encoding
26Rated
27DVD Release Date
28Run Time
29Keyword
30Screen Saver For MD
31Format
32Region
33Language
34Aspect Ratio
35Number of Discs
36IMDB
37Synopsis
38Producer
39Executive Producer
40Purchase Info
41TV Channel ID
42TV Program ID
43TV Series ID
44Creation Date
45THX Disk ID

One that is missing that would be useful is:
NameParametersReturns
GetMediaAttributeOfTypefilename (13)
attributeType (122)
attributeID (123)

That would allow us to check if an attribute of a given type was set, maybe to avoid over-writing a user-entered value.

I also didn't find a command for associating a picture with a media file.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Automating import of video files with meta data
« Reply #7 on: November 01, 2007, 11:43:53 am »
Hi,

very useful info. It would be nice if all of this would be solvable by just sending messages. This way it would be easy, cause in another way, one should work with .id3 and sql database directly.

BTW, does anyone know how are metadata files handled :
- are .id3 files generated from sql base or vice versa ?
- what one needs to change .id3 file or sql record or both to update some info about file ?

Maybe we could try few commands how they work. There is nice web page about messagesend tricks.... Adding info there would be useful...

http://wiki.linuxmce.org/index.php/MessageSend

I think the easiest way would be to create some new directory and put test audio file in there, trigger Media sync and follow DCERouter's log..

For sniffing what happens when picture is associated with file: those can be created from UI2 (create snapshot or something similar) and again, DCERouter's log could be sniffed...

Regards,

Bulek.
« Last Edit: November 01, 2007, 12:24:20 pm by bulek »
Thanks in advance,

regards,

Bulek.

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: Automating import of video files with meta data
« Reply #8 on: November 02, 2007, 12:48:33 pm »
I just had a talk about Update daemon.

There are generally two sources of metadata info in LMCE : sql and .id3 files.
1. If info is missing in sql and present in .id3 files then it's transferred to sql (I guess this is meant for migration)
2. Any info that is already present in both sources, should be changed in sql only, and daemon will then put it into .id3 file

About reading tags from files :

- I've found few Perl modules that could help in dealing with that... :

http://search.cpan.org/~dongxu/Audio-TagLib-1.43/

anyone more experienced with sql and Perl ? We need small help - to browse directory tree and check/update sql info

anyone with more insight into making screenshots from video file ? I remember that Freevo used to do this with mplayer (one simple command line)....


HTH,

Bulek.
Thanks in advance,

regards,

Bulek.