Release Python script to fix messed up "Date Added"
#1
Hi XBMC users.

When I add movies to the library, XBMC sets "Date Added" to the file creation date. That is exactly how I like it. I use 3rd party tools to add movies to the library which are not recognized by XBMC itself. For example XBNE works great. Unfortunately it adds the new files with the current date in "Date Added" and not the file creation or modification date.

So I wrote a simple python script, which I'd like to share with you, which goes through all movies in the library and changes "Date Added" to each file's last modification date.

Notes:
  • This is not an XBMC AddOn. It’s just a simple python script that manipulates the sqlite video database directly. So handle with care, and back up you video database.
  • Also exit XBMC before you run this script.
  • This script was tested with XBMC 13.0 Gotham – Beta 4.
  • Change the location of your video database in the script accordingly. If you don't know where it is, check this: http://wiki.xbmc.org/?title=Userdata
  • If the script does not find file names with special characters, you might change the encoding from ‘cp1252′ to whatever you have. cp1252 is the standard encoding in windows for Western Europe.
  • This only changes movie file library entries. Not TV series.

Link to blog entry with script:

http://www.netzgewitter.com/2014/05/pyth...d-in-xbmc/

Update: 2015-07-27: Added MySQL Database support
Update: 2015-12-06: Updated script to work with a database change in Kode database Version 93
Reply
#2
I do believe you could have just used advancedsettings.xml and set dateadded to what your trying to do...

http://wiki.xbmc.org/?title=Advancedsett...deolibrary
Quote: <dateadded>1</dateadded> <!-- 0 results in using the current datetime when adding a video;
1 (default) results in prefering to use the files mtime (if it's valid) and only using the file's ctime if the mtime isn't valid;
2 results in using the newer datetime of the file's mtime and ctime -->
Reply
#3
Yes, but that only works for newly added entries. Not for movies that are already in the database.
Reply
#4
Is there a newbie guide or is this intended for users that know what they're doing? (You can probably guess which one I am...) Wink
Reply
#5
(2014-10-05, 22:00)LakersFan Wrote: Is there a newbie guide or is this intended for users that know what they're doing? (You can probably guess which one I am...) Wink

Hi. Well it's unfortunately not very newbie friendly. But it's not that hard either. Here is a quick guide.

  1. It's a Python script. So you need to have the Python interpreter installed. You can download it from https://www.python.org/downloads/. The scripts was written for python 2.7.
  2. IMPORTANT 1: Exit XBMC. It must not be running while the script is executed.
  3. Then you have to determine where the XBMC movie database is located. Take a look here (http://wiki.xbmc.org/?title=Userdata). It's name is something like MyVideos...db.
  4. IMPORTANT 2: Make a backup of this file. Just in case.
  5. Open a text editor (notepad will do) and copy/paste the script from http://www.netzgewitter.com/2014/05/pyth...d-in-xbmc/ into the editor.
  6. Somewhere at the beginning of the script locate the line where it says "# IMPORTANT: Change this to your own MyVideos DB". Change the path to the file location of you own MyVideos.db.
  7. Save the script somewhere onto your hard disk and name it fixdates.py.
  8. Run the script with Python.
Step 8 depends on your operating system. If you're on windows it's like:
  1. Open the command prompt. (Enter cmd in start menu).
  2. Change to the directory into which you created the script. E.g. "cd C:\Downloads".
  3. Run the script by executing "python fixdates.py"
Hope that helps. Let me know if you need more help.
Reply
#6
Thanks for the guide. Sorry it's been a month but I finally got a chance to mess with this. Smile The guide is very straightforward, so I appreciate that. However, I am getting the following error:
Code:
D:\Program Files (x86)\Python>python fixdates.py
Loading sqlite3 as DB engine
Traceback (most recent call last):
  File "fixdates.py", line 77, in <module>
    cursor = conn.execute('SELECT idMovie, idFile, strFileName, strPath, dateAdd
ed FROM movieview ORDER BY idFile')
sqlite3.OperationalError: no such table: movieview

D:\Program Files (x86)\Python>

One thing to note, since I am running kodi from Amazon Fire TV, I couldn't add the network link to the MyVideos78.db file. So I copied the file over to my Windows PC and tried to edit it from there. Not sure if that makes a difference...

Thank you!
Reply
#7
Hi LakersFan.

Copying the file over to windows is generally fine, but that causes some additional problems:

Problem 1:

You get that error you mentioned, if the path to the database file is not correctly set in the script. Open the script in a text editor and look for the line:

Code:
DB = os.path.join(r"C:\Program Files\XBMC-Beta\portable_data\userdata\Database", 'MyVideos78.db')

You need to change the part "C:\Program Files\XBMC-Beta\portable_data\userdata\Database", to the directory wherever you put the MyVideos78.db file on your windows machine.

Problem 2:

And there is another problem you'll be facing. The script needs to have access to the movie files in order to determine the file creation date of each movie. I am not familiar with Fire TV, but I guess it accesses the movies from somewhere over the network. So hopefully, your windows machine has access to the movies as well. If this is the case, the file paths that are stored in the database will still not match the file paths on windows (Fire TV seems to be an Android/Linux device, so I guess they use unix style file paths).

It's not really a problem, but the script needs a little bit of tweaking to correct the file paths, in order to be able to find the movies. I can help you with that. Just run the script again. You'll get a lot of errors like "File xyz does not exist!". Send me the output of the script and tell me the file location of the movies as seen from your windows box, and I can make you a custom script that will still run.

Regards.
Reply
#8
I changed that line to this:
Code:
# IMPORTANT: Change this to your own MyVideos DB
DB = os.path.join(r"D:\working\", 'MyVideos78.db')

Now I get this...
Code:
D:\Program Files (x86)\Python>python fixdates.py
  File "fixdates.py", line 17
    DB = os.path.join(r"D:\working\", 'MyVideos78.db')
                                                     ^
SyntaxError: EOL while scanning string literal

D:\Program Files (x86)\Python>

My file is located here: D:\working\MyVideos78.db

Not sure if I have a typo?
Reply
#9
Hi.

No, you actually did it correctly. But there are no backslashes allowed at the end of python raw strings. To make a long story short, write it like that (remove backslash at the end of D:\working\):

Code:
DB = os.path.join(r"D:\working", 'MyVideos78.db')
Reply
#10
That did the trick for problem 1. Big Grin

Problem 2: Here is the code:
Code:
e of Meatballs.mkv does not exist!
File smb://TOWER/Movies/SD/Dance Flick/Dance Flick.mkv does not exist!
File smb://TOWER/Movies/SD/Daniel Tosh - Happy Thoughts/Daniel Tosh - Happy Thou
ghts.mkv does not exist!
File smb://TOWER/Movies/SD/Dead Man Walking/Dead Man Walking.mkv does not exist!

File smb://TOWER/Movies/SD/Dead Poets Society/Dead Poets Society.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Dear John/Dear John.mkv does not exist!
File smb://TOWER/Movies/SD/Deuce Bigalow - Male Gigolo/Deuce Bigalow - Male Gigo
lo.mkv does not exist!
File smb://TOWER/Movies/SD/Double Jeopardy/Double Jeopardy.mkv does not exist!
File smb://TOWER/Movies/SD/Dragnet/Dragnet.mkv does not exist!
File smb://TOWER/Movies/SD/Dragonfly/Dragonfly.mkv does not exist!
File smb://TOWER/Movies/SD/Dumbo/Dumbo.mkv does not exist!
File smb://TOWER/Movies/SD/Eddie Murphy's Delirious/Eddie Murphy's Delirious.mkv
does not exist!
File smb://TOWER/Movies/SD/Eddie Murphy's Raw/Eddie Murphy's Raw.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Ella Enchanted/Ella Enchanted.mkv does not exist!
File smb://TOWER/Movies/SD/Eloise at the Plaza/Eloise at the Plaza.mkv does not
exist!
File smb://TOWER/Movies/SD/Escape To Witch Mountain/Escape To Witch Mountain.mkv
does not exist!
File smb://TOWER/Movies/SD/EuroTrip (Unrated)/EuroTrip.mkv does not exist!
File smb://TOWER/Movies/SD/Exorcism Of Emily Rose/Exorcism Of Emily Rose.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Fear/Fear.mkv does not exist!
File smb://TOWER/Movies/SD/Fletch Lives/Fletch Lives.mkv does not exist!
File smb://TOWER/Movies/SD/Flicka/Flicka.mkv does not exist!
File smb://TOWER/Movies/SD/Flushed Away/Flushed Away.mkv does not exist!
File smb://TOWER/Movies/SD/Fools Gold/Fools Gold.mkv does not exist!
File smb://TOWER/Movies/SD/Four Brothers/Four Brothers.mkv does not exist!
File smb://TOWER/Movies/SD/Freaky Friday/Freaky Friday.mkv does not exist!
File smb://TOWER/Movies/SD/Fun With Dick and Jane/Fun With Dick and Jane.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Garfield/Garfield.mkv does not exist!
File smb://TOWER/Movies/SD/Gremlins 2 The New Batch/Gremlins 2 The New Batch.mkv
does not exist!
File smb://TOWER/Movies/SD/Gung Ho/Gung Ho.mkv does not exist!
File smb://TOWER/Movies/SD/Hannah Montana The Movie/Hannah Montana The Movie.mkv
does not exist!
File smb://TOWER/Movies/SD/Happy Feet/Happy Feet.mkv does not exist!
File smb://TOWER/Movies/SD/Honey I Shrunk the Kids/Honey I Shrunk the Kids.mkv d
oes not exist!
File smb://TOWER/Movies/SD/Hoodwinked/Hoodwinked.mkv does not exist!
File smb://TOWER/Movies/SD/Hoot/Hoot.mkv does not exist!
File smb://TOWER/Movies/SD/Horton Hears a Who/Horton Hears a Who.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Hotel For Dogs/Hotel For Dogs.mkv does not exist!
File smb://TOWER/Movies/SD/House of 1000 Corpses/House of 1000 Corpses.mkv does
not exist!
File smb://TOWER/Movies/SD/House Of Wax/House Of Wax.mkv does not exist!
File smb://TOWER/Movies/SD/How To Eat Fried Worms/How To Eat Fried Worms.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Ice Princess/Ice Princess.mkv does not exist!
File smb://TOWER/Movies/SD/Iceman/Iceman.mkv does not exist!
File smb://TOWER/Movies/SD/Igor/Igor.mkv does not exist!
File smb://TOWER/Movies/SD/Imagine That/Imagine That.mkv does not exist!
File smb://TOWER/Movies/SD/It's the Easter Beagle Charlie Brown/It's the Easter
Beagle Charlie Brown.mkv does not exist!
File smb://TOWER/Movies/SD/Jersey Girl/Jersey Girl.mkv does not exist!
File smb://TOWER/Movies/SD/Johnny Dangerously/Johnny Dangerously.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Just My Luck/Just My Luck.mkv does not exist!
File smb://TOWER/Movies/SD/Kung Fu Panda/Kung Fu Panda.mkv does not exist!
File smb://TOWER/Movies/SD/Lady and the Tramp II/Lady and the Tramp II.mkv does
not exist!
File smb://TOWER/Movies/SD/Lilo & Stitch 2/Lilo & Stitch 2.mkv does not exist!
File smb://TOWER/Movies/SD/Lucky Number Slevin/Lucky Number Slevin.mkv does not
exist!
File smb://TOWER/Movies/SD/Maid In Manhattan/Maid In Manhattan.mkv does not exis
t!
File smb://TOWER/Movies/SD/Major League 2/Major League 2.mkv does not exist!
File smb://TOWER/Movies/SD/Major League 3/Major League 3.mkv does not exist!
File smb://TOWER/Movies/SD/Material Girls/Material Girls.mkv does not exist!
File smb://TOWER/Movies/SD/Matilda/Matilda.mkv does not exist!
File smb://TOWER/Movies/SD/Mean Girls 2/Mean Girls 2.mkv does not exist!
File smb://TOWER/Movies/SD/Meet the Robinsons/Meet the Robinsons.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Monster/Monster.mkv does not exist!
File smb://TOWER/Movies/SD/Monster In Law/Monster In Law.mkv does not exist!
File smb://TOWER/Movies/SD/Mr. Magorium's Wonder Emporium/Mr. Magorium's Wonder
Emporium.mkv does not exist!
File smb://TOWER/Movies/SD/Mulan 2/Mulan 2.mkv does not exist!
File smb://TOWER/Movies/SD/Nim's Island/Nim's Island.mkv does not exist!
File smb://TOWER/Movies/SD/No Country For Old Men/No Country For Old Men.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Not Another Teen Movie/Not Another Teen Movie.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Observe And Report/Observe And Report.mkv does not ex
ist!
File smb://TOWER/Movies/SD/One Hour Photo/One Hour Photo.mkv does not exist!
File smb://TOWER/Movies/SD/Open Season/Open Season.mkv does not exist!
File smb://TOWER/Movies/SD/Open Season 2/Open Season 2.mkv does not exist!
File smb://TOWER/Movies/SD/Over the Top/Over the Top.mkv does not exist!
File smb://TOWER/Movies/SD/Pee Wee's Big Adventure/Pee Wee's Big Adventure.mkv d
oes not exist!
File smb://TOWER/Movies/SD/Platoon/Platoon.mkv does not exist!
File smb://TOWER/Movies/SD/Pocahontas/Pocahontas.mkv does not exist!
File smb://TOWER/Movies/SD/Pocahontas 2/Pocahontas 2.mkv does not exist!
File smb://TOWER/Movies/SD/Premonition/Premonition.mkv does not exist!
File smb://TOWER/Movies/SD/Princess Protection Program/Princess Protection Progr
am.mkv does not exist!
File smb://TOWER/Movies/SD/Pump Up The Volume/Pump Up The Volume.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Race to Witch Mountain/Race to Witch Mountain.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Radio/Radio.mkv does not exist!
File smb://TOWER/Movies/SD/Real Genius/Real Genius.mkv does not exist!
File smb://TOWER/Movies/SD/Return From Witch Mountain/Return From Witch Mountain
.mkv does not exist!
File smb://TOWER/Movies/SD/Revenge of the Nerds 2/Revenge of the Nerds 2.mkv doe
s not exist!
File smb://TOWER/Movies/SD/Richard Pryor Live on the Sunset Strip/Richard Pryor
Live on the Sunset Strip.mkv does not exist!
File smb://TOWER/Movies/SD/Robots/Robots.mkv does not exist!
File smb://TOWER/Movies/SD/Romy and Michele's High School Reunion/Romy and Miche
le's High School Reunion.mkv does not exist!
File smb://TOWER/Movies/SD/Rumor Has It/Rumor Has It.mkv does not exist!
File smb://TOWER/Movies/SD/RV/RV.mkv does not exist!
File smb://TOWER/Movies/SD/Scooby-Doo/Scooby-Doo.mkv does not exist!
File smb://TOWER/Movies/SD/Scooby-Doo 2 Monsters Unleashed/Scooby-Doo 2 Monsters
Unleashed.mkv does not exist!
File smb://TOWER/Movies/SD/Seems Like Old Times/Seems Like Old Times.mkv does no
t exist!
File smb://TOWER/Movies/SD/Sex And The City/Sex And The City.mkv does not exist!

File smb://TOWER/Movies/SD/She's the Man/She's the Man.mkv does not exist!
File smb://TOWER/Movies/SD/Shrek the Third/Shrek the Third.mkv does not exist!
File smb://TOWER/Movies/SD/Sky High/Sky High.mkv does not exist!
File smb://TOWER/Movies/SD/Space Camp/Space Camp.mkv does not exist!
File smb://TOWER/Movies/SD/Spiderman 2/Spiderman 2.mkv does not exist!
File smb://TOWER/Movies/SD/Spiderman 3/Spiderman 3.mkv does not exist!
File smb://TOWER/Movies/SD/Sugar and Spice/Sugar and Spice.mkv does not exist!
File smb://TOWER/Movies/SD/Surviving Christmas/Surviving Christmas.mkv does not
exist!
File smb://TOWER/Movies/SD/Sweet November/Sweet November.mkv does not exist!
File smb://TOWER/Movies/SD/Tarzan & Jane/Tarzan & Jane.mkv does not exist!
File smb://TOWER/Movies/SD/Tarzan II/Tarzan II.mkv does not exist!
File smb://TOWER/Movies/SD/Tenacious D - The Pick of Destiny/Tenacious D - The P
ick of Destiny.mkv does not exist!
File smb://TOWER/Movies/SD/The Abyss/The Abyss.mkv does not exist!
File smb://TOWER/Movies/SD/The Adventures of Sharkboy and Lavagirl/The Adventure
s of Sharkboy and Lavagirl.mkv does not exist!
File smb://TOWER/Movies/SD/The Amityville Horror/The Amityville Horror.mkv does
not exist!
File smb://TOWER/Movies/SD/The Back-Up Plan/The Back-Up Plan.mkv does not exist!

File smb://TOWER/Movies/SD/The Benchwarmers/The Benchwarmers.mkv does not exist!

File smb://TOWER/Movies/SD/The Devil's Rejects/The Devil's Rejects.mkv does not
exist!
File smb://TOWER/Movies/SD/The Exorcist/The Exorcist.mkv does not exist!
File smb://TOWER/Movies/SD/The Fan/The Fan.mkv does not exist!
File smb://TOWER/Movies/SD/The General's Daughter/The General's Daughter.mkv doe
s not exist!
File smb://TOWER/Movies/SD/The Hot Chick/The Hot Chick.mkv does not exist!
File smb://TOWER/Movies/SD/The Hottie & the Nottie/The Hottie & the Nottie.mkv d
oes not exist!
File smb://TOWER/Movies/SD/The Italian Job/The Italian Job.mkv does not exist!
File smb://TOWER/Movies/SD/The Jungle Book/The Jungle Book.mkv does not exist!
File smb://TOWER/Movies/SD/The Jungle Book 2/The Jungle Book 2.mkv does not exis
t!
File smb://TOWER/Movies/SD/The Last Mimzy/The Last Mimzy.mkv does not exist!
File smb://TOWER/Movies/SD/The Lion King 1 1.5/The Lion King 1 1.5.mkv does not
exist!
File smb://TOWER/Movies/SD/The Little Mermaid/The Little Mermaid.mkv does not ex
ist!
File smb://TOWER/Movies/SD/The Little Mermaid - Ariel's Beginning/The Little Mer
maid - Ariel's Beginning.mkv does not exist!
File smb://TOWER/Movies/SD/The Little Mermaid 2/The Little Mermaid 2.mkv does no
t exist!
File smb://TOWER/Movies/SD/The Lizzie McGuire Movie/The Lizzie McGuire Movie.mkv
does not exist!
File smb://TOWER/Movies/SD/The Longest Yard/The Longest Yard.mkv does not exist!

File smb://TOWER/Movies/SD/The Money Pit/The Money Pit.mkv does not exist!
File smb://TOWER/Movies/SD/The New Guy/The New Guy.mkv does not exist!
File smb://TOWER/Movies/SD/The Notebook/The Notebook.mkv does not exist!
File smb://TOWER/Movies/SD/The Perfect Man/The Perfect Man.mkv does not exist!
File smb://TOWER/Movies/SD/The Princess Diaries/The Princess Diaries.mkv does no
t exist!
File smb://TOWER/Movies/SD/The Princess Diaries 2/The Princess Diaries 2.mkv doe
s not exist!
File smb://TOWER/Movies/SD/The Proposal/The Proposal.mkv does not exist!
File smb://TOWER/Movies/SD/The Ring/The Ring.mkv does not exist!
File smb://TOWER/Movies/SD/The Rundown/The Rundown.mkv does not exist!
File smb://TOWER/Movies/SD/The Sandlot 2/The Sandlot 2.mkv does not exist!
File smb://TOWER/Movies/SD/The Scorpion King/The Scorpion King.mkv does not exis
t!
File smb://TOWER/Movies/SD/The Spiderwick Chronicles/The Spiderwick Chronicles.m
kv does not exist!
File smb://TOWER/Movies/SD/The Strangers/The Strangers.mkv does not exist!
File smb://TOWER/Movies/SD/The Village/The Village.mkv does not exist!
File smb://TOWER/Movies/SD/The Wild/The Wild.mkv does not exist!
File smb://TOWER/Movies/SD/Three O'Clock High/Three O'Clock High.mkv does not ex
ist!
File smb://TOWER/Movies/SD/Tinkerbell/Tinkerbell.mkv does not exist!
File smb://TOWER/Movies/SD/Tinkerbell and the Lost Treasure/Tinkerbell and the L
ost Treasure.mkv does not exist!
File smb://TOWER/Movies/SD/Treasure Planet/Treasure Planet.mkv does not exist!
File smb://TOWER/Movies/SD/Unaccompanied Minors/Unaccompanied Minors.mkv does no
t exist!
File smb://TOWER/Movies/SD/Uptown Girls/Uptown Girls.mkv does not exist!
File smb://TOWER/Movies/SD/Wall-E/Wall-E.mkv does not exist!
File smb://TOWER/Movies/SD/White Men Can't Jump/White Men Can't Jump.mkv does no
t exist!
File smb://TOWER/Movies/SD/White Noise/White Noise.mkv does not exist!
File smb://TOWER/Movies/SD/Who Framed Roger Rabbit/Who Framed Roger Rabbit.mkv d
oes not exist!
File smb://TOWER/Movies/SD/Wildcats/Wildcats.mkv does not exist!
File smb://TOWER/Movies/SD/Wrong Turn/Wrong Turn.mkv does not exist!
File smb://TOWER/Movies/SD/You Me And Dupree/You Me And Dupree.mkv does not exis
t!
File smb://TOWER/Movies/SD/Young Guns 2/Young Guns 2.mkv does not exist!
File smb://TOWER/Movies/SD/Yours Mine And Ours/Yours Mine And Ours.mkv does not
exist!
File smb://TOWER/Movies/SD/Zathura/Zathura.mkv does not exist!
File smb://TOWER/Movies/SD/Zoom/Zoom.mkv does not exist!
File smb://TOWER/Movies/HD/101 Dalmatians/101 Dalmatians.mkv does not exist!
File smb://TOWER/Movies/SD/Spiderman/Spiderman.mkv does not exist!
File smb://TOWER/Movies/HD/Step Up 3D/Step Up 3D.mkv does not exist!
File smb://TOWER/Movies/SD/Summer School/Summer School.mkv does not exist!
File smb://TOWER/Movies/SD/Tarzan/Tarzan.mkv does not exist!
File smb://TOWER/Movies/SD/The Lion King 2/The Lion King 2.mkv does not exist!
File smb://TOWER/Movies/HD/Footloose (720p)/Footloose.mkv does not exist!
File smb://TOWER/Movies/HD/Dr. Seuss How The Grinch Stole Christmas/Dr. Seuss Ho
w The Grinch Stole Christmas.mkv does not exist!
File smb://TOWER/Movies/HD/Mission Impossible/Mission Impossible.mkv does not ex
ist!
File smb://TOWER/Movies/HD/The Karate Kid/The Karate Kid.mkv does not exist!
File smb://TOWER/Movies/HD/Total Recall/Total Recall.mkv does not exist!
File smb://TOWER/Movies/SD/Borat/Borat.mkv does not exist!
File smb://TOWER/Movies/SD/When A Stranger Calls/When A Stranger Calls.mkv does
not exist!
File smb://TOWER/Movies/HD/Mama/Mama.mkv does not exist!
File smb://TOWER/Movies/HD/Piranha/Piranha.mkv does not exist!
File smb://TOWER/Movies/HD/Planet of the Apes/Planet of the Apes.mkv does not ex
ist!
File smb://TOWER/Movies/HDTV/Private Parts/Private Parts.mkv does not exist!
File smb://TOWER/Movies/SD/The Rookie/The Rookie.mkv does not exist!
File smb://TOWER/Movies/SD/Runaway/Runaway.mkv does not exist!
File smb://TOWER/Movies/SD/Shall We Dance/Shall We Dance.mkv does not exist!
File smb://TOWER/Movies/HD/Sleeping Beauty (720p)/Sleeping Beauty.mkv does not e
xist!
File smb://TOWER/Movies/HD/Van Wilder/Van Wilder.mkv does not exist!
File smb://TOWER/Movies/HD/Waiting/Waiting.mkv does not exist!
File smb://TOWER/Movies/HD/Black Sheep/Black Sheep.mkv does not exist!
File smb://TOWER/Movies/SD/Hercules/Hercules.mkv does not exist!
File smb://TOWER/Movies/SD/The Hills Have Eyes/The Hills Have Eyes.mkv does not
exist!
File smb://TOWER/Movies/SD/Jack/Jack.mkv does not exist!
File smb://TOWER/Movies/SD/Kicking And Screaming/Kicking And Screaming.mkv does
not exist!
File smb://TOWER/Movies/HD/Mr and Mrs Smith/Mr and Mrs Smith.mkv does not exist!

File smb://TOWER/Movies/SD/Cinderella II/Cinderella II.mkv does not exist!
File smb://TOWER/Movies/SD/Nancy Drew/Nancy Drew.mkv does not exist!
File smb://TOWER/Movies/HD/Blended/Blended.mkv does not exist!
File smb://TOWER/Movies/HD/Casper/Casper.mkv does not exist!
File smb://TOWER/Movies/HD/Draft Day/Draft Day.mkv does not exist!
File smb://TOWER/Movies/HD/Dolphin Tale/Dolphin Tale.mkv does not exist!
File smb://TOWER/Movies/HD/Godzilla (2014)/Godzilla.mkv does not exist!
File smb://TOWER/Movies/HD/Neighbors/Neighbors.mkv does not exist!
File smb://TOWER/Movies/HD/The Fault In Our Stars/The Fault In Our Stars.mkv doe
s not exist!

D:\Program Files (x86)\Python>

Unfortunately, as you can see I have a ton of movies so the Windows commandline truncates it at a certain point from the top. Hopefully this can help out. Or perhaps you know of a way to keep all the command line info so I can paste it all.

Thanks so much for your help with this.
Reply
#11
Hi.

Excellent, that's perfect. I don't need all the lines. Please also tell me where the movie files are as seen from your Windows PC. Like C:\Movies\SD\Dance Flick\Dance Flick.mkv or so. Then I will modify the script to translate smb://TOWER... into whatever it is on your Windows machine. Are all the movies in the same location (smb://TOWER)? Or are there any other places that I can't see because of the truncated output.

Regards.
Reply
#12
On my Windows machine, I can access them through: \\TOWER\Movies

Inside I have 3 movies folders - HD, HDTV, & SD. Inside of those are the movies, each in their individual folders. Example: \\TOWER\Movies\HD\Apollo 13\Apollo 13.mkv
Reply
#13
Alright, I think we are almost there. Here is a modified version of the script:

http://www.netzgewitter.com/files/public...kersFan.py

Hopefully this will work for you.

Once the script is done, you can copy MyVideos78.db back to your Amazon Fire TV box. You should keep a backup of the original file until you are sure nothing was messed up. You should also exit XBMC, in case it is running, before copying back MyVideos78.db. It's not safe to replace the database file while it might be still accessed by a program.

Good luck.
Reply
#14
Thanks for my custom code! However, I'm getting this error:
Code:
D:\Program Files (x86)\Python>python fixdates_LakersFan.py
Loading sqlite3 as DB engine
Traceback (most recent call last):
  File "fixdates_LakersFan.py", line 95, in <module>
    process_row(conn, row)
  File "fixdates_LakersFan.py", line 65, in process_row
    dateadded_new = time.strftime(date_format, time.localtime(lastmod))
ValueError: (22, 'Invalid argument')

D:\Program Files (x86)\Python>
Reply
#15
Hmmm. That's an odd error. After some research I found out that this happens when a movie file has a date prior to 1970.

Well anyway, I have made some changes to the script. I hope this will handle the date better. You can download it from the same link again:

http://www.netzgewitter.com/files/public...kersFan.py

PS: Sorry for the late response. I had a busy week last week.
Reply

Logout Mark Read Team Forum Stats Members Help
Python script to fix messed up "Date Added"0