LinHES Forums
http://forum.linhes.org/

Video Manager - Moving Files with MetaData
http://forum.linhes.org/viewtopic.php?f=17&t=16046
Page 1 of 1

Author:  mooseboots [ Sun Aug 05, 2007 11:27 am ]
Post subject:  Video Manager - Moving Files with MetaData

So, I'm loading up my machine with .vob files.

After awhile, I decide I want to create folders to organize them. I originally dumped everything into the main /myth/video and added data from IMDB in Video Manager.

/myth/video/

Now, I created some folders in /myth/video - for this post, let's just say I did it by year.

/myth/video/1982
/myth/video/1983

etc. etc.

Now, if I just do a simple command like...

mv /myth/video/foo.vob /myth/video/1982/.

I blow out the metadata and have to re-enter it in Video Manager.

I'd be more than willing to write a script to handle this - but where is the metadata stored, and how is it tied to a specific .vob path and file?

Anyone have any knowledge on this?

I'm expecting that I'll be moving folders around a lot for ease of navigation, and I'm probably not the only person with a desire to do so. I think this would be a useful script.

I'll post any script I write.

Thanks!

Author:  slowtolearn [ Sun Aug 05, 2007 5:41 pm ]
Post subject: 

I'm still running R5D1 so the tables may have changed, but most of the data for videos is stored in videometadata. Try
Code:
mysql mythconverg <<EOF
show tables;
quit
EOF
for other possibilities.

Author:  marc.aronson [ Mon Aug 13, 2007 10:27 pm ]
Post subject: 

I'm on R5D1. The table you want is called "videometadata" in R5D1 and the column you need to update is called "filename".

Marc

Author:  mooseboots [ Wed Oct 10, 2007 6:08 pm ]
Post subject:  sql_fill script for non-IMDB data

I created a short shell script to parse a flat file and add a plot summary into Video Manager via a MySQL command.

The flat file is just a normal text file that contains the following information in this format...

Bloody Body in Vegas:27 May 2003:A small amount of DNA evidence left at the scene allows the CSI team to track down the assailant

Note that this is all on one-line!!! For popular TV shows, you can find episode summaries on-line. In VI, you can use the J command to join text onto a single line. Useful tip for creating this metadatafile.

I also list my video files in the following naming convention...

01-video-filename
02-video-filename
03-video-filename

That's why I have the command [0-9][0-9] in my ls command below.

This controls the order of the files in VideoManager. The videos are in the same order in the flat file.

Then, run this script as a user with permission to edit your MySQL table that stores your VideoManager data.

Code:
#!/bin/bash
videodir="/myth/video/sub-directory"
let "episodenum=1"
metadatafile=flat_file_with_your_metadata.mtd

ls ${videodir}/[0-9][0-9]* | while read videofile; do
    echo ${episodenum}
    episode_summary=$(head -n${episodenum} ${metadatafile} | tail -n1)

    if [ ${episodenum} -lt 10 ]; then
    two_digit_episode_num='0'${episodenum}
    else
    two_digit_episode_num=${episodenum}
    fi

    title=${two_digit_episode_num}'-'$(echo ${episode_summary} | cut -f1 -d":");
    airdate=$(echo ${episode_summary} | cut -f2 -d":" | cut -f3 -d " ");
    plot_summary=$(echo ${episode_summary} | cut -f3 -d":" | sed "s/'/\\\'/g")

    echo ${videofile}
    echo ${title}
    echo ${airdate}
    echo ${plot_summary}

    dataexists=$(mysql --skip-column-names -B -p$password -e "use mythconverg; select filename from videometadata where filename='${videofile}';")
    if [ ! -n "$dataexists" ]
    then
        echo "Metadata does not exist for ${title}"
    else
        echo "Metadata found for ${title}!  Updating!"
        mysql -p$password -e "use mythconverg; UPDATE videometadata SET title='${title}',plot='${plot_summary}',year='${airdate}' where filename='${videofile}';"
    fi
    let "episodenum++"
done
[/code]

Author:  Girkers [ Fri Oct 12, 2007 4:42 pm ]
Post subject: 

mooseboots, could you edit your post and put your code in a "code" section just makes it much easier to read and then you also know what to copy and paste exactly.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/