Author Topic: MythTv Filenaming convention change...  (Read 1328 times)

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
MythTv Filenaming convention change...
« on: August 14, 2008, 02:43:43 pm »
I have already opened a Mantis ticked for this feature request, but wanted to open it up for some discussion.

Currently, recording created with MythTV have a very cryptic filename consisting of the channelID (not necessarily the Channel Number), creation date, etc. It makes it a mess to try to edit attributes via Media Files Sync, or try to find any particular recording at all without using a MythTV frontend. This makes managing a large recording library in LMCE extremely difficult.

The prolem is, this is just how MythTV stores recordings, and there is no user-defined way of changing it. Manually renaming the files is not a great option either, as the MythTV database tables will be out of sync, making the MythTV frontend not work for these files.

So what are some options?
1) Add another User Job that executes after recording that renames the file, then also renames the entries in the database. The problem here is that LMCE move/rename/delete functionality would have to take into consideration MythTV's database.

2) Creat another directory full of Symbolic Links to the original files, but with human-readable names. This has the positive side that MythTV frontends will work as normal with no changes, but then you have the problem of keeping the symbolic links in sync with the actual files, considering they can be moved/deleted/renamed by both MytTV and LMCE. It would almost make sense to have the sym links created right in the appropriate /home/data/video directory used by LMCE, and have the symlinks added to the LMCE database instead of the original MythTV files. Again, the big problem here is sorting out the mess of keeping the symLinks in sync with the files knowing that there are 3 ways they could change (from MythTV, from LMCE, and from the OS level)

3) New Feature/Sourcecode change to MythTV that allows users to specify their recording filename format. However, this should be done on the MythTV end, and not applied as a patch as it would turn into a headache keeping up with MythTV releases. The good is that it would fix the problem, the bad is that it would need implemented of course.


Anyone else have some input on this?

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTv Filenaming convention change...
« Reply #1 on: August 29, 2008, 08:21:05 pm »
Quote
2) Creat another directory full of Symbolic Links to the original files, but with human-readable names. This has the positive side that MythTV frontends will work as normal with no changes, but then you have the problem of keeping the symbolic links in sync with the actual files, considering they can be moved/deleted/renamed by both MytTV and LMCE. It would almost make sense to have the sym links created right in the appropriate /home/data/video directory used by LMCE, and have the symlinks added to the LMCE database instead of the original MythTV files. Again, the big problem here is sorting out the mess of keeping the symLinks in sync with the files knowing that there are 3 ways they could change (from MythTV, from LMCE, and from the OS level)

I have done this with the mythtv perl script called mythrename.pl.gz
 It is located in
Code: [Select]
/usr/share/doc/mythtv-backend/contribAnd simply needs to be gunzip'd into /usr/local/bin.
Back in my knoppmyth days, KM used a script called mythpretty.sh which called this perl scipt to populate all if the mythtv recordings in a directory called /mythtv/pretty, for the means of sharing it out to non-mythtv upnp clients, or vlc, or mplayer, whatever your poison.

What this does is create a symlink to your actualy 1122_20080828.mpg files and links them (in a directory you specify) as Ghost Hunters - Shadow People 8_28_2008 in the specified directory.

Now the issue I see is that I have 2 tuners on 2 different machines the local (tv_shows_1) and the MD moon56 (tv_shows_56)

I create the script called mythpretty1 on the core and mkdir /home/public/tv1 and /home/public/tv2
Code: [Select]
#!/bin/bash
cd /home/public/data/videos/tv_shows_1
/usr/local/bin/mythrename.pl --link /home/public/tv1
Now I cron the job to run every night at midnight:
Code: [Select]
crontab -e
Code: [Select]
0 0 * * * /usr/local/bin/mythpretty1
Now over on moon56, I create the script /usr/local/bin/mythpretty56
Code: [Select]
#!/bin/bash
cd /home/public/data/videos/tv_shows_56
/usr/local/bin/mythrename.pl --link /home/public/tv2

And cron that on the md
Code: [Select]
crontab -e
Code: [Select]
0 0 * * * /usr/local/bin/mythpretty56

Now every night at midnight, the directories are sync'd up resulting in :

Code: [Select]
dcerouter_84580:/home/public/tv1# ls -l
Absolutely Fabulous - 2008-08-13, 0-20 AM - Door Handle.mpg
Absolutely Fabulous - 2008-08-20, 0-20 AM - Happy New Year.mpg
Absolutely Fabulous - 2008-08-27, 0-20 AM - Sex.mpg
Blue's Clues - 2008-07-26, 5-00 PM - Blue's Big Mystery.mpg
Blue's Clues - 2008-07-26, 5-30 PM - What Was Blue's Dream About.mpg
Blue's Clues - 2008-07-27, 5-00 PM - What Does Blue Want to Build.mpg
Blue's Clues - 2008-07-27, 5-30 PM - Pool Party.mpg
Blue's Clues - 2008-07-29, 7-30 AM - Superfriends!.mpg
Blue's Clues - 2008-07-31, 5-00 PM - Bedtime Business.mpg
Blue's Clues - 2008-08-04, 5-00 PM - What Does Blue Want to Do on a Rainy Day.mpg
Blue's Clues - 2008-08-05, 5-00 PM - The Baby's Here!.mpg
Bones - 2008-08-27, 8-00 PM - The Pain in the Heart; The Wannabe in the Weeds.nuv
Caillou - 2008-07-29, 10-30 AM - Caillou the Builder.nuv
Caillou - 2008-07-30, 10-30 AM - Caillou to the Rescue.mpg
Caillou - 2008-08-04, 10-30 AM - Caillou the Explorer.nuv
Caillou - 2008-08-05, 10-30 AM - The Starry Night.mpg
Caillou - 2008-08-06, 10-30 AM - Caillou the Bookworm.mpg
Caillou - 2008-08-07, 10-30 AM - Vacations.mpg
Coupling - 2008-08-13, 1-00 AM - Gotcha.mpg
Coupling - 2008-08-19, 11-00 PM - Dressed.mpg
Coupling - 2008-08-26, 11-00 PM - Naked.mpg
Dora the Explorer - 2008-07-30, 9-30 AM - The Super Silly Fiesta.mpg
Dora the Explorer - 2008-07-31, 9-30 AM - Boots' Special Day.nuv
Dora the Explorer - 2008-08-04, 9-30 AM.nuv
Dora the Explorer - 2008-08-05, 9-00 AM - We're a Team!.mpg
Dora the Explorer - 2008-08-05, 9-30 AM.mpg
Fab Five- The Texas Cheerleader Scandal - 2008-08-02, 9-00 PM.nuv
Ghost Hunters International - 2008-07-30, 11-02 PM - Shattered Spirit.mpg
Ghost Hunters International - 2008-08-06, 11-00 PM - Hauntings of South Africa.mpg
Ghost Hunters International - 2008-08-13, 11-00 PM - Tortured Souls.mpg
Ghost Hunters International - 2008-08-20, 11-00 PM - Dracula's Castle.mpg
How to Look Good Naked - 2008-08-26, 10-00 PM - Jennifer Morgan Ford.nuv
Little Bear - 2008-07-26, 4-00 PM - Picnic at Pudding Hill; Little Bear's Walkabout; Little Bear's Secret Friend.mpg
Little Bear - 2008-07-26, 4-30 PM - Owl's Dilemma; School for Otters; Spring Cleaning.mpg
Little Bear - 2008-07-27, 4-00 PM - Wish Upon a Star; Sleepy Head Monster; Opposites Day.mpg
Little Bear - 2008-07-27, 4-30 PM - Little Bear Sings a Song; A House for Mitzi; Up a Tree.mpg
Little Bear - 2008-07-31, 4-30 PM - Follow the Leader; Rafting on the River; How to Scare Crows.mpg
Little Bear - 2008-08-04, 4-30 PM - Sleep Over; Sand Castle; Happy Anniversary.nuv
Little Bear - 2008-08-05, 4-30 PM - Little Bear and the Ice Boat; Baby Deer; The Invisible Little Bear.mpg
Lost Boys- The Tribe - 2008-08-02, 1-00 AM.mpg
Max & Ruby - 2008-08-20, 10-00 AM - Ruby's Safari; Max's Mudbath; Max's Lost Lizard.mpg
Max & Ruby - 2008-08-22, 7-00 AM - Ruby Delivers; Getting Crabby at the Beach; Max Babysits.mpg
Max & Ruby - 2008-08-27, 7-00 AM - Max's Ant Farm; Sugar Plum Max; Ruby's Puppet Show.mpg
Max & Ruby - 2008-08-29, 7-00 AM - Max's Fire Flies; Max & Ruby's Fashion Show; Ruby's Sing- a- long.mpg
Not Going Out - 2008-08-12, 11-40 PM.mpg
Not Going Out - 2008-08-19, 11-40 PM.mpg
Primeval - 2008-08-23, 9-00 PM.mpg
Radio - 2008-08-11, 8-14 PM.nuv
Robin Hood - 2008-07-26, 8-00 PM - Treasure of the Nation.mpg
Robin Hood - 2008-08-03, 0-00 AM - We Are Robin Hood.mpg
Skins - 2008-08-24, 10-00 PM - Jal.mpg
Skins - 2008-08-24, 9-00 PM - Cassie.mpg
South Park - 2008-07-26, 10-00 PM - Simpsons Already Did It.mpg
South Park - 2008-07-26, 10-30 PM - Make Love, Not Warcraft.mpg
South Park - 2008-07-26, 11-00 PM - Good Times With Weapons.mpg
South Park - 2008-07-26, 11-30 PM - Cartoon Wars.mpg
South Park - 2008-07-27, 0-30 AM - It Hits the Fan.mpg
Stargate Atlantis - 2008-08-01, 10-00 PM - The Daedalus Variations.mpg
Stargate Atlantis - 2008-08-15, 10-00 PM - The Ghost in the Machine.mpg
Stargate Atlantis - 2008-08-22, 10-00 PM - The Shrine.mpg
The Nanny - 2008-08-28, 8-00 AM - Kissing Cousins.mpg
The Nanny - 2008-08-28, 8-30 AM - The Fifth Wheel.mpg
True Confessions of a Hollywood Starlet - 2008-08-09, 9-00 PM.nuv
What a Girl Wants - 2008-08-25, 9-30 PM.mpg
Wow! Wow! Wubbzy! - 2008-07-26, 2-00 PM - Follow the Leader; The Wubbzy Shuffle.mpg
Yo Gabba Gabba! - 2008-07-31, 10-00 AM - Careful.nuv
Yo Gabba Gabba! - 2008-08-04, 5-30 PM - Friends.mpg
Yo Gabba Gabba! - 2008-08-05, 5-30 PM - Summer.mpg
Yo Gabba Gabba! - 2008-08-07, 5-30 PM - Eat.nuv
Yo Gabba Gabba! - 2008-08-08, 5-30 PM - Happy.nuv
Yo Gabba Gabba! - 2008-08-08, 5-47 PM - Happy.mpg
Z Rock - 2008-08-24, 11-30 PM.mpg

Code: [Select]
dcerouter_84580:/home/public/tv2# ls
Apollo 13 - 2008-08-14, 8-00 PM.mpg
Ghost Hunters - 2008-08-27, 10-00 PM - Whispers and Voices.mpg
Ghost Hunters - 2008-08-27, 11-00 PM - Best of Stanley Hotel.mpg
Ghost Hunters - 2008-08-27, 9-00 PM - Shadow People.mpg
Primeval - 2008-08-09, 9-00 PM.mpg
Primeval - 2008-08-16, 9-00 PM.mpg
Stargate SG-1 - 2008-08-23, 1-00 AM - The Enemy Within.mpg
Stargate SG-1 - 2008-08-23, 2-00 AM - Emancipation.mpg

So see where you can run with that. This is perfect for my XboxMC on the Xbox, as well as any windows/ubuntu desktops in the house.

Just my findings.

Regards,

Seth
« Last Edit: August 29, 2008, 08:29:22 pm by seth »
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: MythTv Filenaming convention change...
« Reply #2 on: September 03, 2008, 07:40:27 pm »
Seth- thanks for the reply

I looked at doing the SymLink method, but it kind of over-complicates things a bit. For instance, then we need to look for cases when the original file is deleted via web admin, or at the OS level.

I was leaning towards renaming the file, as well as updating the mythconverge database to reflect this. I know the Recordings table would need updated as well so that mythweb still works, as well as deleting from within mythtv. I need to find out if there are more tables that store the filename. If we can 1)rename the recordings and 2) update mythconverge db with the new filename information, I would think it would be the cleanest solution. Of course, they you still have to deal with keeping things in sync if the file is deleted from web admin or OS.....