Author Topic: Working to get rid of "8753_20071221203559.mpg" type video list entries  (Read 8578 times)

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile

I previously had a LOAD of "8753_20071221203559.mpg" etc entries at the top of the videos screen. I noticed that in the filesystem there were actually a lot more mythtv recordings than there were in mythweb. So first I sorted this out:

Code: [Select]
#!/bin/sh

mysqldump mythconverg recorded > /tmp/recorded

cd /home/public/data/videos/tv_shows_1
mkdir orphans

for file in *.mpg ; do
echo "Looking for $file"

results=`grep $file /tmp/recorded | awk -F\/ '{print $7}' | awk -F \' '{print $1}' | wc -l`
if [ $results -eq 0 ] ; then
echo "Error! Not found!!"
mv $file orphans/
mv $file.* orphans/
fi

echo " "

done


I later moved this orphans folder to another place on my file system and then at the end deleted it. Now I had to remove them from the pluto database:

# mysql pluto_media
> delete from File where Path like '%tv_show%';
> quit

As you can see I decided to delete all my tv recordings. Don't panic, as attributes are held in the id3 files on the filesystem.

I resynchronised the folder and now only had a couple of pages of videos messing up the top of my list. So I created a script to repeat the mythtv "save recording to pluto database" function. As a test I deleted all the id3 files for the mythtv recordings.

Script:

Code: [Select]
#!/bin/sh
dir=$1

cd $dir
for file in *.mpg ; do
  echo "Adding $file to LMCE db"
  f=\'$file\'
  chanid=`mysql mythconverg -se "select chanid from recorded where basename = $f" | tail -1`
  starttime=`mysql mythconverg -se "select starttime from recorded where basename = $f" | tail -1`
  mysql mythconverg -se "select title,subtitle from recorded where basename = $f" | tail -1
  echo "Running /usr/pluto/bin/SaveMythRecording.sh "$chanid" "$starttime" "$dir" "$file""
  /usr/pluto/bin/SaveMythRecording.sh "$chanid" "$starttime" "$dir" "$file"
done

Hey presto - the script caused pluto to regenerate the id3 files. It did NOT add the recordings back to the db though which I found odd. I had to do a resynchronise from the web admin site. No errors in the DCERouter log.

HOWEVER, I have 7 files which LMCE will not regenerate id3 files for. These 7 files are in the mythtv db, and appear in mythweb. When the script above asks LMCE to add them there are no errors in the log. eg:

07      12/22/07 14:18:09.041           Received Message from 0 (unknown / ) to -1001 (unknown / ), type 2 id 69 Event:MythTV Show Recorded, re
try none, parameters: <0x70ce6b90>
07      12/22/07 14:18:09.041             Parameter 29(MythTV ChannelID): 8753 <0x70ce6b90>
07      12/22/07 14:18:09.042             Parameter 35(Name): /home/public/data/videos/tv_shows_1/8753_20071221210000.mpg <0x70ce6b90>
07      12/22/07 14:18:09.042             Parameter 57(DateTime): 2007-12-21 21:00:00 <0x70ce6b90>


But no id3 file.

I've learnt a lot, but have some questions:

1. Why no id3 file for a few videos?
2. Why are recordings not added to the db?
3. I have "Update media daemon" unchecked, does this affect number 2?
4. Event with Update media daemon unchecked overnight LMCE has added media in folders I never chose to synchronise. have I misunderstood this function?


Thanks,

Chris

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Working to get rid of "8753_20071221203559.mpg" type video list entries
« Reply #1 on: December 22, 2007, 05:22:48 pm »
It turns out these are recordings in the category "LiveTV". They are hanging around from when I was watching TV the other day. I have updated the script to remove these recordings from the LinuxMCE database.

I suspect I will need to set this to run periodically. The script also now skips files which have an associated id3 file.

Script:

Code: [Select]
#!/bin/sh
dir=$1

cd $dir
for file in *.mpg ; do
  echo $file
  if [ -e $file.id3 ] ; then
        echo "id3 already exists"
  else
        f=\'$file\'
        chanid=`mysql mythconverg -se "select chanid from recorded where basename = $f" | tail -1`
        starttime=`mysql mythconverg -se "select starttime from recorded where basename = $f" | tail -1`
        mysql mythconverg -se "select title,subtitle from recorded where basename = $f" | tail -1
        recgroup=`mysql mythconverg -se "select recgroup from recorded where basename = $f" | tail -1`
        if [ $recgroup == 'LiveTV' ] ; then
                echo "This is a LiveTv recording, deleting from db if present"
                mysql pluto_media -se "delete from File where Filename = $f"
        else
                echo "Running /usr/pluto/bin/SaveMythRecording.sh "$chanid" "$starttime" "$dir" "$file""
                /usr/pluto/bin/SaveMythRecording.sh "$chanid" "$starttime" "$dir" "$file"
        fi
  fi
done

1audio

  • Addicted
  • *
  • Posts: 552
    • View Profile
Re: Working to get rid of "8753_20071221203559.mpg" type video list entries
« Reply #2 on: December 30, 2007, 07:13:07 am »
I have this same problem and some entries in my video list that came from the Myth UPNP server as well. I would like to try your solution if you can give some more details for the non-technical among us. I can open an SSH session into the core and some other basic stuff but I'm not sure how to implement your "cleaning" script.