[LINUX] bash script for finding not-scraped movies
#31
zosky Wrote:if you're looking for requests; i say don't waist your time with samba.
declare winblows and all its junk out of scope.
after all this is a linux script right ... NFS is what it should support! Laugh

if some1 must absolutly use samba (then i feel sad for them, but)
you should suggest smbFS to mount them


I stream high bitrate (35 Mbps) Blu Ray 1080p over a wireless connection with SMB. No issues. There is nothing wrong with SMB. All this talk about it's too slow and it sucks ..blah...blah is hogwash and unfounded.

Its simple, fast and works. Not to mention NO mounting is required.
Reply
#32
FishOil Wrote:I stream high bitrate (35 Mbps) Blu Ray 1080p over a wireless connection with SMB. No issues. There is nothing wrong with SMB. All this talk about it's too slow and it sucks ..blah...blah is hogwash and unfounded.

Its simple, fast and works. Not to mention NO mounting is required.

you argument doesn't hold water when you put autoFS into the mix ... it makes [re]mounting automatic. (& it can do SMB). also to be fair, i never said anything about SMB being slow or sucky; only controlled by microSofty.
wikipedia.org (on CSIF) Wrote:Most usage of SMB involves computers running Microsoft Windows, where it is often known as "Microsoft Windows Network"

i think this conversation is moot anyway. the current version is full of FAIL Confused... it reported most of my files missing from the DB because the they are stacked (...cd1.avi, ...cd2.avi) & missing because they are in sub-folders (~/movies/some-movie/the.movie.avi). i hope the next version can get past stacks & sub-folders
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#33
zosky Wrote:if you're looking for requests; i say don't waist your time with samba.
declare winblows and all its junk out of scope.
after all this is a linux script right ... NFS is what it should support!
In a perfect world we all would use the same stable, high performance and transparent network capable filesystem.
But we are living in World 1.0 and I guess there will never be an update Rolleyes

So I will try to implement smb:// connections. It's doable but as I actually don't have a working setup I will first have to setup that. And as I already said: no time at all at the moment. Hope this gets better within the next two months Confused

zosky Wrote:the current version is full of FAIL Confused... it reported most of my files missing from the DB because the they are stacked (...cd1.avi, ...cd2.avi) & missing because they are in sub-folders (~/movies/some-movie/the.movie.avi).
Hmmm, stacked entries should at least be listed in db-stacked.lst. In will try to compare entries in filesystem with entries in stacked list but as mentioned before: not now.

Subfolders should be handled. Could you paste the corresponding entries from the result files where the media files are listed? And probably the corresponding path entry from the database? At the moment I see no reason why subfolders should not work with this script.
For further assistance you also can disable removing of intermediate files by commenting the last line of the script, beginning with ${RMCMD}. Just preceed it with a '#' and the files wont be deleted. Then you can check every step and see where the files are listed
Reply
#34
thanks for the quick response. i dont mean to knock your efforts. i really want to hook this into cron to push DB.QA emails @weekly.

BaerMan Wrote:Hmmm, stacked entries should at least be listed in db-stacked.lst. In will try to compare entries in filesystem with entries in stacked list but as mentioned before: not now.

they are, & as soon as you bump that against the fs-only.lst to truly report fs-only, you get the GOLD. just "not now" Laugh

BaerMan Wrote:Subfolders should be handled. Could you paste the corresponding entries from the result files where the media files are listed? And probably the corresponding path entry from the database? At the moment I see no reason why subfolders should not work with this script.
For further assistance you also can disable removing of intermediate files by commenting the last line of the script, beginning with ${RMCMD}. Just preceed it with a '#' and the files wont be deleted. Then you can check every step and see where the files are listed

db_files.lst ...
Code:
/home/zosky/movies/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS.avi
/home/zosky/movies/Bulletproof.Monk.DVDRiP.XViD-DEiTY/bpm.dvdrip.xvid-deity.avi
/home/zosky/movies/Catwoman.DVDRip.XViD-ALLiANCE/alliance-catwoman.dvdrip.xvid.avi

find.lst ...
Code:
/home/zosky/movies/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS.avi
/home/zosky/movies/Bulletproof.Monk.DVDRiP.XViD-DEiTY/bpm.dvdrip.xvid-deity.avi
/home/zosky/movies/Catwoman.DVDRip.XViD-ALLiANCE/alliance-catwoman.dvdrip.xvid.avi

diff.lst ...
Code:
-/home/zosky/movies/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS.avi
-/home/zosky/movies/Bulletproof.Monk.DVDRiP.XViD-DEiTY/bpm.dvdrip.xvid-deity.avi
-/home/zosky/movies/Catwoman.DVDRip.XViD-ALLiANCE/alliance-catwoman.dvdrip.xvid.avi

just so we have all cards on the table: im not running this on my xbmc box. i'm garbing the db & updating paths so they compute on another machine. this should NOT impact anything you're doing. all the comparisons above are identical. these should compute Huh

Code:
scp ${DBPATHXBMC} ${DBPATH}
${SQLITECMD} $DBPATH "UPDATE path SET strpath = REPLACE (strpath, '/xbmc/homeNAS/', '/zosky/')"
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#35
zosky Wrote:db_files.lst ...
Code:
/home/zosky/movies/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS.avi
/home/zosky/movies/Bulletproof.Monk.DVDRiP.XViD-DEiTY/bpm.dvdrip.xvid-deity.avi
/home/zosky/movies/Catwoman.DVDRip.XViD-ALLiANCE/alliance-catwoman.dvdrip.xvid.avi

find.lst ...
Code:
/home/zosky/movies/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS.avi
/home/zosky/movies/Bulletproof.Monk.DVDRiP.XViD-DEiTY/bpm.dvdrip.xvid-deity.avi
/home/zosky/movies/Catwoman.DVDRip.XViD-ALLiANCE/alliance-catwoman.dvdrip.xvid.avi

diff.lst ...
Code:
-/home/zosky/movies/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS/Billy.Elliot.2000.iNTERNAL.DVDRip.XviD-FLS.avi
-/home/zosky/movies/Bulletproof.Monk.DVDRiP.XViD-DEiTY/bpm.dvdrip.xvid-deity.avi
-/home/zosky/movies/Catwoman.DVDRip.XViD-ALLiANCE/alliance-catwoman.dvdrip.xvid.avi
As far as I can see, these lines are absolutely identical. Therefore there should not be such output in the difflist. Are there any special characters in the real path or in the database? Could you try to clean up the database and run it again? Maybe these entries are old or doubled ones?

Quote:just so we have all cards on the table: im not running this on my xbmc box. i'm garbing the db & updating paths so they compute on another machine. this should NOT impact anything you're doing. all the comparisons above are identical. these should compute Huh

Code:
scp ${DBPATHXBMC} ${DBPATH}
${SQLITECMD} $DBPATH "UPDATE path SET strpath = REPLACE (strpath, '/xbmc/homeNAS/', '/zosky/')"
This code you run outside the script or did you add it to the script itself?

The script is run on the same machine where the database lies?

To be honest: at the moment I have no other idea of what could be responsible for this behaviour. Sad
Reply
#36
BaerMan Wrote:As far as I can see, these lines are absolutely identical. Therefore there should not be such output in the difflist. Are there any special characters in the real path or in the database? Could you try to clean up the database and run it again? Maybe these entries are old or doubled ones?

nope. none of the above Eek

Quote:This code you run outside the script or did you add it to the script itself?
The script is run on the same machine where the database lies?

i've added it inline (right after the VARS) & im running the script on another machine; that why i have to UPDATE/REPLACE the paths in the (copied) DB

my *LIVE* DB has: /home/xbmc/homeNAS/movies/....
within the *COPY* they are changed to look like this: /home/zosky/movies/...

Quote:To be honest: at the moment I have no other idea of what could be responsible for this behaviour. Sad

yup, same here Sad
rPi 2&3 | android phones | fireHD8 | linux | win10 + NFS NAS w/ mySQL + props to...
libreElecyatse, titan, AELflexGet, context.manageTags (a zosky original)
Reply
#37
BaerMan Wrote:So I will try to implement smb:// connections. It's doable but as I actually don't have a working setup I will first have to setup that. And as I already said: no time at all at the moment. Hope this gets better within the next two months Confused


Any progress?

Thanks
Reply
#38
Sorry, I didn't work on this anymore. Have hardly time for anything. Can't promise it's getting better.
Reply
#39
Hi,

I wanted to use this script on my OpenElec system and found that it doesn't work. Sad This is mainly because the necessary program "sqlite3" is not included in OpenElec.

In order to overcome the issue, I made my own version, written in Python and without any dependencies on external programs. It probably isn't as advanced as the original bash script, but it suits my needs.

Usually I don't share things like that, but I thought someone might have a similar issue and be happy for this starting point.

Code:
#!/usr/bin/env python
#-*- coding: utf8 -*-


################################################################################
### Configuration
################################################################################

database_file = '/storage/.xbmc/userdata/Database/MyVideos78.db'
movies_directory = '/storage/videos/'


################################################################################
### Imports
################################################################################

import os, sys

import sqlite3


################################################################################
### Functions
################################################################################

def main():

    # Open database file
    try:
        db = sqlite3.connect(database_file)
    except sqlite3.Error, e:
        sys.stderr.write('Failed opening database file: %s' % e.args[0])
        sys.exit(1)
    else:
        cursor = db.cursor()

    # Get all movies stored in the database
    movies_in_db = {}
    cursor.execute('SELECT c00,strPath,strFilename FROM movieview;')
    for title, directory, filename in cursor.fetchall():
        path = os.path.join(directory, filename)
        movies_in_db[path] = title

        # State right away if a movie in the database doesn't exist on the filesystem (anymore)
        if not os.path.exists(path):
            print('Movie does not exist anymore: %s' % title)

    # Walk through the filesystem (videos only) and check if all files have an entry in the database
    for dirname, subdirnames, filenames in os.walk(movies_directory):
        for filename in filenames:
            path = os.path.join(dirname, filename)
            if not path in movies_in_db:
                print('File is not known to database: %s' % path)


################################################################################
### Main
################################################################################

if (__name__ == '__main__'):

    main()

    sys.exit(0)

Cheers
Criena
Reply
#40
Have you tries Add-on:Missing Movie Scanner (wiki)? This thread is from 2009!
Reply
#41
I was looking for a command line tool (because I often just have SSH access to the system) and found the Wiki page of the bash script. I'm happy with the Python version now.

If someone else wants to use it, they are free to do so. But I agree that an addon with a nice GUI is much easier to handle -- if you sit right in front of the system.
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] bash script for finding not-scraped movies0