clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
672 stars 176 forks source link

Sudden "invalid number of arguments" #1300

Closed Th3MadHatter closed 6 years ago

Th3MadHatter commented 7 years ago

I didn't change a thing and suddenly I started getting

WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...

So I switched all of the logging options the git functions well on but the result was this after connecting

::MAIN: "C:\Program Files\Git\bin\git.exe" rev-list --left-right "@{upstream}"...HEAD : returned successful
DEBUG   ::MAIN: cur_commit = 80c8ad58523ab99825c02f3855f9bd3dc9945d57 % (newest_commit)= 80c8ad58523ab99825c02f3855f9bd3dc9945d57, num_commits_behind = 0, num_commits_ahead = 0
INFO    ::MAIN: No update needed
INFO    ::MAIN: nzbToMedia Version:80c8ad58523ab99825c02f3855f9bd3dc9945d57 Branch:master (Windows 7)
DEBUG   ::MAIN: Connecting to utorrent: http://localhost:41005/gui/
#########################################################
> 2017-09-07 05:43:30 INFO    ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
> 2017-09-07 05:43:30 INFO    ::MAIN: #########################################################
> 2017-09-07 05:43:30 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['C:\\nzbToMedia\\TorrentToMedia.py']
> 2017-09-07 05:43:30 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...

Everything looks fine except for the \ it uses and I can't find any way to change it, I looked everywhere. the command I'm sending is correct C:\nzbToMedia\TorrentToMedia.py "%D" "%N" "%L" "%I"

What on earth could cause this? I've tried restarting thinking it might be a glitch but it worked fine yesterday, today it does this.

Here are the parts of the config file

[SickBeard]
    #### autoProcessing for TV Series
    #### tv - category that gets called for post-processing with SB
    [[tv]]
        enabled = 1
        host = localhost
        port = 41005
        username = <removed>
        password =  <removed>
        ###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
        web_root = ""
        ssl = 0
        fork = auto
        delete_failed = 0
        # Enable/Disable linking for Torrents
        Torrent_NoLink = 0
        keep_archive = 1
        process_method = ""
        # force processing of already processed content when running a manual scan.
        force = 0
        # tell SickRage/Medusa to delete all source files after processing.
        delete_on = 0
        # tell Medusa to ignore check for associated subtitle check when postponing release
        ignore_subs = 0
        extract = 1
        nzbExtractionBy = Downloader
        # Set this to minimum required size to consider a media file valid (in MB)
        minSize = 0
        # Enable/Disable deleting ignored files (samples and invalid media files)
        delete_ignored = 0
        ##### Enable if SickBeard is on a remote server for this category
        remote_path = 0
        ##### Set to path where download client places completed downloads locally for this category
        watch_dir = G:\downloads\complete\utorrent
        ##### Set the recursive directory permissions to the following (0 to disable)
        chmodDirectory = 0

[Torrent]
    ###### clientAgent - Supported clients: utorrent, transmission, deluge, rtorrent, vuze, other
    clientAgent = utorrent
    ###### useLink - Set to hard for physical links, sym for symbolic links, move to move, move-sym to move and link back, and no to not use links (copy)
    useLink = hard
    ###### outputDirectory - Default output directory (categories will be appended as sub directory to outputDirectory)
    outputDirectory = G:\downloads\complete\processed
    ###### Enter the default path to your default download directory (non-category downloads). this directory is protected by safe_mode. 
    default_downloadDirectory = G:\downloads\complete\utorrent
    ###### Other categories/labels defined for your downloader. Does not include CouchPotato, SickBeard, HeadPhones, Mylar categories.
    categories = music_videos, pictures, software, manual
    ###### A list of categories that you don't want to be flattened (i.e preserve the directory structure when copying/linking.
    noFlatten = pictures, manual
    ###### uTorrent Hardlink solution (You must edit this if your using TorrentToMedia.py with uTorrent)
    uTorrentWEBui = http://localhost:41005/gui/
    uTorrentUSR = <removed>
    uTorrentPWD = <removed>
    ###### Transmission (You must edit this if your using TorrentToMedia.py with Transmission)
    TransmissionHost = localhost
    TransmissionPort = 9091
    TransmissionUSR = your username
    TransmissionPWD = your password
    #### Deluge (You must edit this if your using TorrentToMedia.py with deluge. Note that the host/port is for the deluge daemon, not the webui)
    DelugeHost = localhost
    DelugePort = 58846
    DelugeUSR = your username
    DelugePWD = your password
    ###### ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING ######
    deleteOriginal = 0
    chmodDirectory = 0
    resume = 1
    resumeOnFailure = 1

I tested the webui, that works ok, all labels are correct too.

clinton-hall commented 6 years ago

did your utorrent version update? Your config looks correct, but clearly uTorrent isn't passing the directory and label as it should.

Th3MadHatter commented 6 years ago

Sorry I gave up on this for a while because I tried everything but I was not able to fix it.

I did not change utorrent versions, Im still on 3.1.2 (for couchpotato support, else I would roll back to 2.x).

Any ideas? All antivirus and firewall stuff is configurated to completely ignore it once it runs so that isn't it either.

I tried to reclone it and edit a new config by hand but the same issue as above.

clinton-hall commented 6 years ago

try changing the command you are calling from utorrent.

Try C:\nzbToMedia\TorrentToMedia.py '%D' '%N' '%L' '%I' i.e. replacing " with '

or even try without quotes... C:\nzbToMedia\TorrentToMedia.py %D %N %L %I just to see if it logs any different input.

Th3MadHatter commented 6 years ago

Using ' instead of "

"@{upstream}"...HEAD : returned successful 2018-01-16 22:53:10 DEBUG ::MAIN: cur_commit = ee243fbba51e66ed12ad17d57e016b4db5bdc720 % (newest_commit)= ee243fbba51e66ed12ad17d57e016b4db5bdc720, num_commits_behind = 0, num_commits_ahead = 0 2018-01-16 22:53:10 INFO ::MAIN: No update needed 2018-01-16 22:53:10 INFO ::MAIN: nzbToMedia Version:ee243fbba51e66ed12ad17d57e016b4db5bdc720 Branch:master (Windows 7) 2018-01-16 22:53:11 DEBUG ::MAIN: Connecting to utorrent: http://localhost:51200/gui/ 2018-01-16 22:53:14 INFO ::MAIN: ######################################################### 2018-01-16 22:53:14 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2018-01-16 22:53:14 INFO ::MAIN: ######################################################### 2018-01-16 22:53:14 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:\nzbToMedia\TorrentToMedia.py'] 2018-01-16 22:53:14 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ... 2018-01-16 22:53:14 DEBUG ::MAIN: No directories identified in SickBeard:tv for post-processing 2018-01-16 22:53:14 INFO ::MAIN: The C:\nzbToMedia\TorrentToMedia.py script completed successfully.

without quotes

2018-01-16 23:01:56 INFO ::MAIN: Loading config from [C:\nzbToMedia\autoProcessMedia.cfg] 2018-01-16 23:01:56 INFO ::ENVIRONMENT: TMP: C:\Users\COMPU~1\AppData\Local\Temp 2018-01-16 23:01:56 INFO ::ENVIRONMENT: COMPUTERNAME: Computer-PC 2018-01-16 23:01:56 INFO ::ENVIRONMENT: USERDOMAIN: Computer-PC 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PSMODULEPATH: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ 2018-01-16 23:01:56 INFO ::ENVIRONMENT: COMMONPROGRAMFILES: C:\Program Files\Common Files 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 42 Stepping 7, GenuineIntel 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROGRAMFILES: C:\Program Files 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROCESSOR_REVISION: 2a07 2018-01-16 23:01:56 INFO ::ENVIRONMENT: SYSTEMROOT: C:\Windows 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PATH: c:\program files (x86)\intel\icls client\;c:\program files\intel\icls client\;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\program files (x86)\intel\opencl sdk\2.0\bin\x86;c:\program files (x86)\intel\opencl sdk\2.0\bin\x64;c:\windows\system32\windowspowershell\v1.0\;c:\windows\system32\windowspowershell\v1.0\;c:\program files\intel\intel(r) management engine components\dal;c:\program files\intel\intel(r) management engine components\ipt;c:\program files (x86)\intel\intel(r) management engine components\dal;c:\program files (x86)\intel\intel(r) management engine components\ipt;c:\python27;c:\program files (x86)\intel\opencl sdk\2.0\bin\x86;c:\program files (x86)\intel\opencl sdk\2.0\bin\x64;c:\program files\intel\intel(r) management engine components\dal;c:\program files\intel\intel(r) management engine components\ipt;c:\program files (x86)\intel\intel(r) management engine components\dal;c:\program files (x86)\intel\intel(r) management engine components\ipt;C:\Windows\System32\WindowsPowerShell\v1.0\ 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROGRAMFILES(X86): C:\Program Files (x86) 2018-01-16 23:01:56 INFO ::ENVIRONMENT: WINDOWS_TRACING_FLAGS: 3 2018-01-16 23:01:56 INFO ::ENVIRONMENT: TEMP: C:\Users\COMPU~1\AppData\Local\Temp 2018-01-16 23:01:56 INFO ::ENVIRONMENT: COMMONPROGRAMFILES(X86): C:\Program Files (x86)\Common Files 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROCESSOR_ARCHITECTURE: AMD64 2018-01-16 23:01:56 INFO ::ENVIRONMENT: ALLUSERSPROFILE: C:\ProgramData 2018-01-16 23:01:56 INFO ::ENVIRONMENT: LOCALAPPDATA: C:\Users\Computer\AppData\Local 2018-01-16 23:01:56 INFO ::ENVIRONMENT: HOMEPATH: \Users\Computer 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROGRAMW6432: C:\Program Files 2018-01-16 23:01:56 INFO ::ENVIRONMENT: USERNAME: Computer 2018-01-16 23:01:56 INFO ::ENVIRONMENT: LOGONSERVER: \Computer-PC 2018-01-16 23:01:56 INFO ::ENVIRONMENT: SESSIONNAME: Console 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROGRAMDATA: C:\ProgramData 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC 2018-01-16 23:01:56 INFO ::ENVIRONMENT: FP_NO_HOST_CHECK: NO 2018-01-16 23:01:56 INFO ::ENVIRONMENT: WINDIR: C:\Windows 2018-01-16 23:01:56 INFO ::ENVIRONMENT: WINDOWS_TRACING_LOGFILE: C:\BVTBin\Tests\installpackage\csilogfile.log 2018-01-16 23:01:56 INFO ::ENVIRONMENT: HOMEDRIVE: C: 2018-01-16 23:01:56 INFO ::ENVIRONMENT: SYSTEMDRIVE: C: 2018-01-16 23:01:56 INFO ::ENVIRONMENT: COMSPEC: C:\Windows\system32\cmd.exe 2018-01-16 23:01:56 INFO ::ENVIRONMENT: NUMBER_OF_PROCESSORS: 8 2018-01-16 23:01:56 INFO ::ENVIRONMENT: APPDATA: C:\Users\Computer\AppData\Roaming 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PROCESSOR_LEVEL: 6 2018-01-16 23:01:56 INFO ::ENVIRONMENT: COMMONPROGRAMW6432: C:\Program Files\Common Files 2018-01-16 23:01:56 INFO ::ENVIRONMENT: OS: Windows_NT 2018-01-16 23:01:56 INFO ::ENVIRONMENT: PUBLIC: C:\Users\Public 2018-01-16 23:01:56 INFO ::ENVIRONMENT: USERPROFILE: C:\Users\Computer 2018-01-16 23:01:56 INFO ::MAIN: Checking database structure... 2018-01-16 23:01:56 DEBUG ::MAIN: Checking Initial Schema database upgrade 2018-01-16 23:01:56 DB ::MAIN: nzbtomedia.db: SELECT 1 FROM sqlite_master WHERE name = ?; with args ('db_version',) 2018-01-16 23:01:56 DB ::MAIN: nzbtomedia.db: SELECT db_version FROM db_version 2018-01-16 23:01:56 DEBUG ::MAIN: InitialSchema upgrade not required 2018-01-16 23:01:56 DEBUG ::MAIN: Checking if we can use git commands: "C:\Program Files\Git\bin\git.exe" version 2018-01-16 23:01:56 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" version with your shell in C:\nzbToMedia 2018-01-16 23:01:57 DEBUG ::MAIN: git output: git version 2.13.3.windows.1 2018-01-16 23:01:57 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" version : returned successful 2018-01-16 23:01:57 DEBUG ::MAIN: Using: "C:\Program Files\Git\bin\git.exe" 2018-01-16 23:01:57 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" symbolic-ref -q HEAD with your shell in C:\nzbToMedia 2018-01-16 23:01:58 DEBUG ::MAIN: git output: refs/heads/master 2018-01-16 23:01:58 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" symbolic-ref -q HEAD : returned successful 2018-01-16 23:01:58 INFO ::MAIN: Checking if git needs an update 2018-01-16 23:01:58 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-parse HEAD with your shell in C:\nzbToMedia 2018-01-16 23:02:02 DEBUG ::MAIN: git output: ee243fbba51e66ed12ad17d57e016b4db5bdc720 2018-01-16 23:02:02 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-parse HEAD : returned successful 2018-01-16 23:02:02 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" fetch origin with your shell in C:\nzbToMedia 2018-01-16 23:02:06 DEBUG ::MAIN: git output: 2018-01-16 23:02:06 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" fetch origin : returned successful 2018-01-16 23:02:06 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-parse --verify --quiet "@{upstream}" with your shell in C:\nzbToMedia 2018-01-16 23:02:07 DEBUG ::MAIN: git output: ee243fbba51e66ed12ad17d57e016b4db5bdc720 2018-01-16 23:02:07 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-parse --verify --quiet "@{upstream}" : returned successful 2018-01-16 23:02:07 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-list --left-right "@{upstream}"...HEAD with your shell in C:\nzbToMedia 2018-01-16 23:02:07 DEBUG ::MAIN: git output: 2018-01-16 23:02:08 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-list --left-right "@{upstream}"...HEAD : returned successful 2018-01-16 23:02:08 DEBUG ::MAIN: cur_commit = ee243fbba51e66ed12ad17d57e016b4db5bdc720 % (newest_commit)= ee243fbba51e66ed12ad17d57e016b4db5bdc720, num_commits_behind = 0, num_commits_ahead = 0 2018-01-16 23:02:08 INFO ::MAIN: No update needed 2018-01-16 23:02:08 INFO ::MAIN: nzbToMedia Version:ee243fbba51e66ed12ad17d57e016b4db5bdc720 Branch:master (Windows 7) 2018-01-16 23:02:08 DEBUG ::MAIN: Connecting to utorrent: http://localhost:51200/gui/ 2018-01-16 23:02:11 INFO ::MAIN: ######################################################### 2018-01-16 23:02:11 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2018-01-16 23:02:11 INFO ::MAIN: ######################################################### 2018-01-16 23:02:11 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:\nzbToMedia\TorrentToMedia.py'] 2018-01-16 23:02:11 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ... 2018-01-16 23:02:11 DEBUG ::MAIN: No directories identified in SickBeard:tv for post-processing 2018-01-16 23:02:11 INFO ::MAIN: The C:\nzbToMedia\TorrentToMedia.py script completed successfully.

Both failed

clinton-hall commented 6 years ago

it really looks like utorrent isn't passing in the variables, or your Python interpreter is not recognizing the passed variables.

Th3MadHatter commented 6 years ago

But what could possibly cause it since it went from working fine (for years, we set it up together actually lol) to this, over night... or a better question is how do we fix it...

clinton-hall commented 6 years ago

That is what puzzles me. I don't know what could have caused this, but it appears something must have changed.

What happens if you issue the following via command prompt?

C:\nzbToMedia\TorrentToMedia.py "path" "name" "TV" "hash"

if this doesn't pass the variables, the problem is with python. if it does pass the variables the problem is likely with utorrent.

Th3MadHatter commented 6 years ago

C:\nzbToMedia\TorrentToMedia.py "path" "name" "TV" "hash" gives me this

C:\Users\Computer>C:\nzbToMedia\TorrentToMedia.py "path" "name" "TV" "hash" C:\Python27\lib\site-packages\ndg_httpsclient-0.4.2-py2.7.egg\ndg__init__.py:2: UserWarning: Module six was already imported from C:\nzbToMedia\libs\six.pyc, b ut c:\python27\lib\site-packages\six-1.10.0-py2.7.egg is being added to sys.path

import pkg_resources [23:38:54] [INFO]::MAIN: Loading config from [C:\nzbToMedia\autoProcessMedia.cfg ]

snipping a bit because identical

[23:39:04] [INFO]::MAIN: #######################################################

[23:39:04] [INFO]::MAIN: ## ..::[TorrentToMedia.py]::.. ## [23:39:04] [INFO]::MAIN: #######################################################

[23:39:04] [DEBUG]::MAIN: Options passed into TorrentToMedia: ['C:\nzbToMedia\ TorrentToMedia.py'] [23:39:04] [WARNING]::MAIN: Invalid number of arguments received from client, Sw itching to manual run mode ... [23:39:04] [DEBUG]::MAIN: No directories identified in SickBeard:tv for post-pro cessing [23:39:04] [INFO]::MAIN: The C:\nzbToMedia\TorrentToMedia.py script completed su ccessfully.

I don't mind reinstalling something, I just work with SickGear so idk if the repo's create a conflict in python.

clinton-hall commented 6 years ago

try

C:\Python27\python.exe C:\nzbToMedia\TorrentToMedia.py "path" "name" "TV" "hash"
Th3MadHatter commented 6 years ago

That gives more info but very odd info since nothing has changed like directory structure or even labels.

2018-01-16 23:52:12 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:\nzbToMedia\TorrentToMedia.py', 'path', 'name', 'TV', 'hash'] 2018-01-16 23:52:12 DEBUG ::MAIN: Adding TORRENT download info for directory path to database 2018-01-16 23:52:12 DB ::MAIN: nzbtomedia.db: UPDATE downloads SET status = ?, client_agent = ?, last_update = ?, input_id = ?, input_hash = ?, input_name = ? WHERE input_directory = ? with args [0, u'utorrent', 736710, u'hash', u'hash', u'name', u'path'] 2018-01-16 23:52:12 DB ::MAIN: nzbtomedia.db: INSERT OR IGNORE INTO downloads (status, client_agent, last_update, input_id, input_hash, input_name, input_directory) VALUES (?, ?, ?, ?, ?, ?, ?) with args [0, u'utorrent', 736710, u'hash', u'hash', u'name', u'path'] 2018-01-16 23:52:12 DEBUG ::MAIN: Received Directory: path | Name: name | Category: TV 2018-01-16 23:52:12 DEBUG ::MAIN: SEARCH: Could not find the category: TV in the directory structure 2018-01-16 23:52:12 INFO ::MAIN: SEARCH: Could not find a unique directory for this download. Assume a common directory. 2018-01-16 23:52:12 INFO ::MAIN: SEARCH: We will try and determine which files to process, individually 2018-01-16 23:52:12 DEBUG ::MAIN: Determined Directory: path | Name: name | Category: TV 2018-01-16 23:52:13 ERROR ::MAIN: Category:[TV] is not defined or is not enabled. Please rename it or ensure it is enabled for the appropriate section in your autoProcessMedia.cfg and try again. 2018-01-16 23:52:13 ERROR ::MAIN: A problem was reported in the C:\nzbToMedia\TorrentToMedia.py script.

clinton-hall commented 6 years ago

that fixed it... it passed in the values...

so now, in utorrent, set this to call

C:\Python27\python.exe C:\nzbToMedia\TorrentToMedia.py "%D" "%N" "%L" "%I"

this should call python to run TorrentToMedia and pass the variables.

not sure how it changed, but your python is not accepting the variables when a python script is called directly.

Th3MadHatter commented 6 years ago

Solved. You are my hero :+1:

I tried cloning it 15 times in the last few months. Can I call on it in a similar way in deluge? I run multiple clients with different setups.

clinton-hall commented 6 years ago

I believe this still applies to deluge still requires you to call a batch script, so in that batch script

C:\Python27\python.exe C:\nzbToMedia\TorrentToMedia.py %1 %2 %3
Th3MadHatter commented 6 years ago

Ok I will give that a shot.

One final question, it seems to process now but when cleaning dirs it seems to leave the processed files behind.

POSTPROCESS::SICKBEARD: Successfully processed D:\downloads\complete\processed\tv\4k Test Video.mkv\4k Test Video.mkv 2018-01-17 00:28:12 POSTPROCESS::SICKBEARD: ----------------------- 2018-01-17 00:28:12 POSTPROCESS::SICKBEARD: Successfully processed. INFO ::CLEANDIRS: Directory D:\downloads\complete\processed\tv\4k Test Video.mkv still contains 1 unprocessed file(s), skipping ...

While it just said it processed the files. It's not a huge amount of work to clean the dir but it's easy if it's done automatically like it did in the past. Any idea how to get it to clean up after successfully processing because I hard link so if I forget the files it starts hogging space.

clinton-hall commented 6 years ago
[SickBeard]
    [TV]
        delete_on = 1

that may do it.

Th3MadHatter commented 6 years ago

Doesn't seem to work.

[[tv]] enabled = 1 host = localhost port = 51200 username = USER password = PASS

ADVANCED USE - ONLY EDIT IF YOU KNOW WHAT YOU'RE DOING
    web_root = ""
    ssl = 0
    fork = auto
    delete_failed = 0
    # Enable/Disable linking for Torrents
    Torrent_NoLink = 0
    keep_archive = 1
    process_method = ""
    # force processing of already processed content when running a manual scan.
    force = 0
    # tell SickRage/Medusa to delete all source files after processing.
    delete_on = 1

Log

2018-01-17 01:04:36 POSTPROCESS::SICKBEARD: Successfully processed. 2018-01-17 01:04:42 INFO ::CLEANDIRS: Directory D:\downloads\complete\processed\tv\4k test.mkv still contains 1 unprocessed file(s), skipping ... 2018-01-17 01:04:42 INFO ::MAIN: The C:\nzbToMedia\TorrentToMedia.py script completed successfully.

Only file in there is the file it just processed.

Enable/Disable forceful cleaning of leftover files following postprocess force_clean = 1

does work but will also pick up failed to process files I think?

clinton-hall commented 6 years ago
process_method = move
Th3MadHatter commented 6 years ago

Leaves the directory and the file in the process dir.

Th3MadHatter commented 6 years ago

But a more pressing matter. I tried setting up Deluge, that didn't work and at then end of it Deluge won't even start anymore. Not even with a fresh install. So my options where Transmission or Transmission because none of the things I use it for allows Vuze and several that are supported aren't supported by this so I downloaded transmission 2.92.

This: https://github.com/clinton-hall/nzbToMedia/wiki/transmission

Doesn't work on this https://transmissionbt.com/ anymore. Not on a windows 7/8/10 setup at least.

I set everything up properly, it's all reachable by couchpotato, I add a batch file running the script through python, doesn't work. Failed to connect and invalid arguments sent when running it manually so I set all directories, save location to "download" keep incomplete files in "Incomplete" and added the batch file to "Call script when torrent is completed" and checked the box. The file 'finishes' (it never really finishes unless it completes seeding I think, it's so simplistic that it actually makes it more complex, I don't even think labels are supported) but it doesn't call anything when it starts seeding. I tried stopping it by reducing seed ratio to 0 but even when it 'finished' this way it didn't launch. So I tried adding the normal .py file, which doesn't launch on completion either.

I manually ran it again after something finished and it did not connect, it got invalid arguments launching it just like with utorrent both through python and executing it normally, however, switching to manual mode was no problem afterwards but that defeats the purpose of the script because I could just let it run couchpotatos default post processor every 12 hours.

Do you have any ideas or suggestions? I need two clients because I use two separate drives, one for couchpotato files and one for sickgear files and one client won't let me set multiple directories on multiple drives unless I let one drive cache and move from one for the other getting a lot of useless I/O and wear.

clinton-hall commented 6 years ago

ok, to be honest I haven't tried any Torrent clients on Windows for some time. Somewhere, one of them must support postprocess scripts.

the main thing you will need here is to create a second instance of nzbToMedia. so copy C:\nzbToMedia to C:\nzbToMedia2 now edit C:\nzbToMedia2\autoProcessMedia.cfg and set

[Torrent]
    clientAgent = Transmission
    TransmissionHost = localhost
    TransmissionPort = 9091
    TransmissionUSR = your username
    TransmissionPWD = your password

and any other changes you might want for this download client.

Now, you let uTorrent call C:\Python27\python.exe C:\nzbToMedia\TorrentToMedia.py %1 %2 %3 and then set Transmission to call C:\Python27\python.exe C:\nzbToMedia2\TorrentToMedia.py or perhaps call a batch script that calls this... the key, is that it is calling the second instance. this will hopefully prevent the "invalid number of arguments" issue as long as the script is being called on download complete.

Th3MadHatter commented 6 years ago

The problem with transmission is, unless i'm using it wrong which is unlikely, that files never reach a finish state until in a very late period, it's simplistic software and from what I can see putting it in an If, else situation it goes like this (in non coding terms i'm too tired for that).

If file = status 100 set seed Else file = download download

If seed = Param1(ratio) 1 & Param2(time) 1 set Finished Else, seed.

If Finished = ParamSet1(run script) exec Else. (null)

The execute script just doesn't work and the state to reach it is finished which requires seeding to finish as well, which is great for Nzb, and maybe public but not for most users. Software is obviously flawed, and I know that that in no way is working code.

So I've been looking at my options and they are fairly limited, I think qBittorrent is the best option but can it support torrenttomedia. And if so what values would need to be set...

Right now utorrent is working fine so it's clear that it is functioning, unfortunately deluge refuses to work for reasons unknown, it worked just fine, closed it and stopped starting, removed, reinstalled,removed, installed newer version, same issue, so that makes my options a lot more limited.

Utorrent can't run side by side on 1 PC (unless in VM) so I can't just install 2.2.1 and 3.1.2 and there is no way to watch multiple directories and execute different commands when label Y or label Z is finished.

I'm really running out of ideas, maybe you can have a look at qBittorrent and see if that's an option based on the features, pretty sure its open source and runs on linux and bsd too.

clinton-hall commented 6 years ago

I see the issue with Transmission. The details in my last post are still relevant to multiple torrent clients. You will still need to create a second instance of nzbToMedia is the second torrent client is different.

Have you tried deleting all user data and app data for deluge? there must be something there that is causing a conflict, so a complete "clean" install should be possible....

for qbittorrent, setting this in options (select the second set of options in the left hand frame, and scroll down to the option Run external program on torrent completion) then set this to run C:\Python27\python.exe C:\nzbToMedia\TorrentToMedia.py "%D" "%N" "%L" "%I" then in autoProcessMedia.cfg set clientAgent = rtorrent (this is a little work around to test it all out).

Th3MadHatter commented 6 years ago

I already cloned a second one, that's why this one is in the Scripts dir, the other one was just on c:/NzbToMedia. Running a secondary NTM/TTM isn't a problem but finding a client for it is. I had to upgrade to utorrent 3.1.2 for full Couchpotato (3.0.1 lol windows binaries, i'm lazy I know :P) support that didn't work in 2.2.x but if that wasn't the case I'd still be using that today. Since utorrent has no option (or addon/plugin I can find) that creates a secondary or label based file directory I have to run a secondary client for the TTM script.

That's a good idea.. I didn't think of clearing my appdata folder, might give that a try too.

I'm going to get a bit of rest, since I haven't slept since we started yesterday, and then start testing how qbitorrent handles it. I'll report the results back, maybe write a small guide for the wiki if it helps. Lots of sites are becoming very limited when it comes to clients you can choose so multiplatform and multiclient support is great. Thanks for helping me out with this :smiley:

Th3MadHatter commented 6 years ago

Just installed qBt overal it looks like a lightweight mix between utorrent and deluge, it has a nice label and category system settings useful in the future (anonymous mode for I2P/Tor/VPN use scrubbing personal data from connection) and a webui, that could be used to make it work properly (call the right label or category) but I tried running it as you suggested and it failed.

I set the clientagent to rtorrent and the script is running from C:\Python27\python.exe C:\Scripts\nzbToMedia\TorrentToMedia.py "%D" "%N" "%L" "%I"

It silently starts the script after finishing (I wouldn't have noticed if I didn't have my process explorer open) so I checked the log and this is the result

2018-01-18 15:16:12 INFO ::MAIN: nzbToMedia Version:ee243fbba51e66ed12ad17d57e016b4db5bdc720 Branch:master (Windows 7) 2018-01-18 15:16:12 INFO ::MAIN: ######################################################### 2018-01-18 15:16:12 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2018-01-18 15:16:12 INFO ::MAIN: ######################################################### 2018-01-18 15:16:12 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...

Same issue as we had back in uTorrent.

Running it manually from CMD shows this

2018-01-18 20:05:39 INFO ::MAIN: ######################################################### 2018-01-18 20:05:39 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2018-01-18 20:05:39 INFO ::MAIN: ######################################################### 2018-01-18 20:05:39 INFO ::MAIN: SEARCH: Could not find a unique directory for this download. Assume a common directory. 2018-01-18 20:05:39 INFO ::MAIN: SEARCH: We will try and determine which files to process, individually 2018-01-18 20:05:39 ERROR ::MAIN: Category:[%L] is not defined or is not enabled. Please rename it or ensure it is enabled for the appropriate section in your autoProcessMedia.cfg and try again. 2018-01-18 20:05:39 ERROR ::MAIN: A problem was reported in the C:\Scripts\nzbToMedia\TorrentToMedia.py script.

Which is odd because I made a category named movie with the file in it.

clinton-hall commented 6 years ago

can you set this instance of nzbToMedia to have debug logging enabled?

[General]
    log_debug = 1

With the manual run, you would need to replace %L with the actual category (e.g TV) and likewise %D would need to be the directory, %N the name, and %I the torrent Hash. ideally show a debug log after a torrent has finished downloading through qBittorrent

Th3MadHatter commented 6 years ago

2018-01-18 21:18:47 INFO ::MAIN: nzbToMedia >Version:ee243fbba51e66ed12ad17d57e016b4db5bdc720 Branch:master (Windows 7) 2018-01-18 21:18:47 INFO ::MAIN:

######################################################### 2018-01-18 21:18:47 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2018-01-18 21:18:47 INFO ::MAIN: ######################################################### 2018-01-18 21:18:47 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\Download" 4k.Test.Movie.1999.720p.mkv movie aef97f5f872132cda4aea5939ed180f8feefdba7'] 2018-01-18 21:18:47 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...

I think this is what you want to see, it seems like it passes everything through without an issue. Edit: Wait is it supposed to add an argument for dhe TTM dir? that's the only thing that might look wrong to me.

clinton-hall commented 6 years ago

the problem is here 'L:\Download" 4k.Test.Movie.1999.720p.mkv movie aef97f5f872132cda4aea5939ed180f8feefdba7' notice it is passing this as 1 argument... not 4. Also note the " after the directory.... check your settings in qBittorrent to make sure this has the same quotes etc... or maybe try without quotes.

Th3MadHatter commented 6 years ago

C:\Python27\python.exe C:\Scripts\nzbToMedia\TorrentToMedia.py "%D" "%N" "%L" "%I"

Is what gets executed (I copy and pasted your thing), I don't know why it's ' in the first part and " in the second, that's what seems to be passed for some reason....

According to the layout in qB the params are: %D: Directory %N: Name of torrent %L: Category %I: Info-hash

Seems like a success without quotes

2018-01-18 22:29:59 INFO ::MAIN: #########################################################

2018-01-18 22:29:59 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ## 2018-01-18 22:29:59 INFO ::MAIN: ######################################################### 2018-01-18 22:29:59 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\Download\', '4k.Test.Movie.720p.1999.mkv', 'movie', 'aef97f5f872132cda4aea5939ed180f8fdeefdba7'] 2018-01-18 22:29:59 DEBUG ::MAIN: Adding TORRENT download info for directory L:\Download to database

:+1: going to test it in the field

Th3MadHatter commented 6 years ago

It works... but not well. By default qBittorent adds files without a category. They do this so you can quickly move files from one directory to another by just switching labels or categories. In this case its not that great..

it results in this being received by TTM

::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\Download\', 'Test.Movie.2017.720p.BluRay.DD5.1.x264', '5d255af1ad42465c3531131d722907a06aaafdc2'] 2018-01-18 23:23:46 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...

Which means it misses a value and doesn't call Couchpotato but just switches to manual mode. I have no idea how to solve this issue, google did not help, it seems like default category is not an option and the default category is left blank.

Edit: Fixed. Was running couchpotato 3.0.1 (old windows version), decided to Git up and upgrade, problem solved.

Edit again: Unfortunately not done yet, close one problem and and another shows up. I'm trying all sorts of combinations to see what it does. When I take a file that does not look.like.this.here but has spaces in between I get these arguments '3D' 'Preview' 'Despicable', 'Me', '3', '2017' in the log file, when I use C:\Python27\python.exe C:\Scripts\nzbToMedia\TorrentToMedia.py %D %N %L %I
When I run it like this C:\Python27\python.exe C:\Scripts\nzbToMedia\TorrentToMedia.py "%D" "%N" "%L" "%I" I get these arguments 'C:/Scripts/nzbToMedia/TorrentToMedia.py', 'V:\\Download" '3D' 'Preview' Despicable', 'Me', '3', '2017', '1080p', 'DD5.1', 'x264.mkv movie 9efca82896f27c027fbb35edea8bd513f60f7ecf' When I run it as C:\Python27\python.exe C:\Scripts\nzbToMedia\TorrentToMedia.py '%D' '%N' '%L' '%I' I get these arguments 'C:/Scripts/nzbToMedia/TorrentToMedia.py', "'V:\\Download\\'", "'3D' 'Preview' 'Despicable", 'Me', '3', '2017', '1080p', 'DD5.1', "x264.mkv'", "'movie'", "'9efca82896f27c027fbb35edea8bd513f60f7ecf'" I really don't know what to do anymore...

clinton-hall commented 6 years ago

try "C:\Python27\python.exe" "C:\Scripts\nzbToMedia\TorrentToMedia.py" "%D" "%N" "%L" "%I" see if that resolves the unbalanced quotes.

Th3MadHatter commented 6 years ago

Will try in the morning, was just about to turn in. I eventually got it to process but I had to heavily modify the name, removing everything but despicableme3.mkv made it pass through the script but made couchpotato go ???, despicable-me-3.2017.mkv worked for both of them. The weird thing is that it isn't even the 3 in the name causing it to screw up because it had no problem processing something with .2048. in the title.

I'll give it a try tomorrow and see what it does, however, "%D" seems to end up in 'L:\Download" every single time, might be a bug or a conflict using the rtorrent profile.

Couchpotato nearly always says the %I hash is unknown and incorrect in its log with a mention about rtorrent as well. Even the ones that do process.

Either way this is one of the smoothest clients I've worked with so far and I think I pretty much tried them all so I hope it will work out eventually :)

Th3MadHatter commented 6 years ago

Thad didn't work. It seems to push everything into the directory container because it closes it with a again. 'C:/Scripts/nzbToMedia/TorrentToMedia.py', 'V:\\Download" Kevin.Hart.What.Now.Preview.2016.720p.BluRay.x264-YouTube movie c68113cd6f5be4673f1104346efda1b5babdab52'

clinton-hall commented 6 years ago

weird... it really appears qBitTorrent is not feeding these through as separated parameters as desired... maybe let us try a simpler solution... set qBittorrent to launch a bat script

"C:\ppscript.bat" "%D" "%N" "%L" "%I"

then this C:\ppscript.bat script will simply call

"C:\Python27\python.exe" "C:\Scripts\nzbToMedia\TorrentToMedia.py" %1 %2 %3 %4
Th3MadHatter commented 6 years ago

With the bat set as above

2018-01-19 19:31:40 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:\Scripts\nzbToMedia\TorrentToMedia.py', 'L:\Download" 3D.Preview.The.Nut.Job.2.Nutty.by.Nature.2017.720p.x264-Youtube movie 3395b3a057b03d36e2d22e9f193a7f13eaa4f3ef'] 2018-01-19 19:31:40 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...

It does pick up on it in manual mode, but that takes so long and having that run often isn't exactly good for the HDD.

clinton-hall commented 6 years ago

can you check C:\Users\<user>\AppData\Roaming\qBittorrent\qBittorrent.ini

[AutoRun]
program=\"C:/Python27/python.exe\" \"C:/Scripts/nzbToMedia/TorrentToMedia.py\" \"%D\" \"%N\" \"%L\" \"%I\"
enabled=true

I see the above when I set "C:/Python27/python.exe" "C:/Scripts/nzbToMedia/TorrentToMedia.py" "%D" "%N" "%L" "%I"

I am wondering if the spaces need to be escaped...

program=\"C:/Python27/python.exe\"\ \"C:/Scripts/nzbToMedia/TorrentToMedia.py\"\ \"%D\"\ \"%N\"\ \"%L\"\ \"%I\"
Th3MadHatter commented 6 years ago

With the bat script "C:\ppscript.bat" "%D" "%N" "%L" "%I" it looks like this

[AutoRun]
enabled=true
program=\"C:/ppscript.bat\" \"%D\" \"%N\" \"%L\" \"%I\"

If I set it to "C:/Python27/python.exe" "C:/Scripts/nzbToMedia/TorrentToMedia.py" "%D" "%N" "%L" "%I" it looks like this

[AutoRun]
enabled=true
program=\"C:/Python27/python.exe\" \"C:/Scripts/nzbToMedia/TorrentToMedia.py\" \"%D\" \"%N\" \"%L\" \"%I\"

The escaped version program=\"C:/Python27/python.exe\"\ \"C:/Scripts/nzbToMedia/TorrentToMedia.py\"\ \"%D\"\ \"%N\"\ \"%L\"\ \"%I\" gives me this

2018-01-20 05:00:55 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\\Download" Guardians', 'of', 'the', 'Galaxy', 'Vol.', '2', '2017', '3D', 'Demo', 'DD5.1', 'x264-Youtube movie cdabdee3c21238ad1afef4ca982ea1737ce14a2e4']
2018-01-20 05:00:55 DEBUG   ::MAIN: Adding TORRENT download info for directory L:\Download" Guardians to database
2018-01-20 05:00:56 DEBUG   ::MAIN: Received Directory: L:\Download" Guardians | Name: of | Category: the
2018-01-20 05:00:56 DEBUG   ::MAIN: SEARCH: Could not find the category: the in the directory structure
2018-01-20 05:00:56 INFO    ::MAIN: SEARCH: Could not find a unique directory for this download. Assume a common directory.
2018-01-20 05:00:56 INFO    ::MAIN: SEARCH: We will try and determine which files to process, individually
2018-01-20 05:00:56 DEBUG   ::MAIN: Determined Directory: L:\Download" Guardians | Name: of | Category: the
2018-01-20 05:00:56 ERROR   ::MAIN: Category:[the] is not defined or is not enabled. Please rename it or ensure it is enabled for the appropriate section in your autoProcessMedia.cfg and try again.
2018-01-20 05:00:56 ERROR   ::MAIN: A problem was reported in the C:/Scripts/nzbToMedia/TorrentToMedia.py script.

Edit: Also, another really odd thing, maybe you know. Couchpotato keeps auto scanning my \Download\ dir since I set up qBt while I didn't set it up anywhere in Couchpotato, not even in the qBt settings in Couchpotato. The renamer is set to go from \Processing\ to \Movies\, yet it keeps scanning, finding new things, creating dirs there and crashing my Rpi with updates ever 2 hours or so. A bit off topic but its bugging the heck out of me and I know you're on a good base with Ruud from way back :)

clinton-hall commented 6 years ago

for couchpotato, look at settings, renamer, "run_every" and "force_every". Both should be 0. restart CP after making these changes.

I cant figure out why qBittorrent isn't separating the options correctly. It might be possible to pass these as 1 parameter and use a custom separator to split these within nzbToMedia.

Th3MadHatter commented 6 years ago

Thanks that fixed the couchpotato thing.

Take your time figuring it out, I just have it set up and ready to test once you figure out which parameters will split it. Maybe it will require a new profile for qbittorent and other c++ Qt toolkit based clients (transmission switched to Qt as well), but it seems to be a popular client among Couchpotato/Sonarr/Sickbeard users and the only client right now with an Anonymous mode (which is interesting for Encrypted Cloud-based Users and VPN users so it will gain popularity in the future) so having a profile ready to work will save you a lot of tickets in the future.

clinton-hall commented 6 years ago

ok, please update to latest nightly build and test... I haven't added the api interface to pause qbittorrent etc, but hopefully this will allow the parameters to be imported...

[Torrent]
    clientAgent = qbittorrent

in qBittorrent eet this to call "C:\Python27\python.exe" "C:\Scripts\nzbToMedia\TorrentToMedia.py" "%D|%N|%L|%I"

here we are trying to pass all the parameters as 1 simple string with | used to split them.

Th3MadHatter commented 6 years ago

It doesn't want to switch to nightly for some reason but the outcome looks promising

# GitHUB branch for repo
    git_branch = nightly
2018-01-21 11:41:55 INFO    ::MAIN: Loading config from [C:\Scripts\nzbToMedia\autoProcessMedia.cfg]
2018-01-21 11:41:56 INFO    ::MAIN: Checking database structure...
2018-01-21 11:41:56 DEBUG   ::MAIN: Checking Initial Schema database upgrade
2018-01-21 11:41:56 DEBUG   ::MAIN: InitialSchema upgrade not required
2018-01-21 11:41:56 DEBUG   ::MAIN: Checking if we can use git commands: "C:\Program Files\Git\bin\git.exe" version
2018-01-21 11:41:56 DEBUG   ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" version with your shell in C:\Scripts\nzbToMedia
2018-01-21 11:41:59 DEBUG   ::MAIN: "C:\Program Files\Git\bin\git.exe" version : returned successful
2018-01-21 11:41:59 DEBUG   ::MAIN: Using: "C:\Program Files\Git\bin\git.exe"
2018-01-21 11:41:59 DEBUG   ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" symbolic-ref -q HEAD with your shell in C:\Scripts\nzbToMedia
2018-01-21 11:41:59 DEBUG   ::MAIN: "C:\Program Files\Git\bin\git.exe" symbolic-ref -q HEAD : returned successful
2018-01-21 11:41:59 INFO    ::MAIN: Checking if git needs an update
2018-01-21 11:41:59 DEBUG   ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-parse HEAD with your shell in C:\Scripts\nzbToMedia
2018-01-21 11:42:00 DEBUG   ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-parse HEAD : returned successful
2018-01-21 11:42:00 DEBUG   ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" fetch origin with your shell in C:\Scripts\nzbToMedia
2018-01-21 11:42:09 DEBUG   ::MAIN: "C:\Program Files\Git\bin\git.exe" fetch origin : returned successful
2018-01-21 11:42:09 DEBUG   ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-parse --verify --quiet "@{upstream}" with your shell in C:\Scripts\nzbToMedia
2018-01-21 11:42:09 DEBUG   ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-parse --verify --quiet "@{upstream}" : returned successful
2018-01-21 11:42:09 DEBUG   ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-list --left-right "@{upstream}"...HEAD with your shell in C:\Scripts\nzbToMedia
2018-01-21 11:42:10 DEBUG   ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-list --left-right "@{upstream}"...HEAD : returned successful
2018-01-21 11:42:10 DEBUG   ::MAIN: cur_commit = ee243fbba51e66ed12ad17d57e016b4db5bdc720 % (newest_commit)= ee243fbba51e66ed12ad17d57e016b4db5bdc720, num_commits_behind = 0, num_commits_ahead = 0
2018-01-21 11:42:10 INFO    ::MAIN: No update needed
2018-01-21 11:42:10 INFO    ::MAIN: nzbToMedia Version:ee243fbba51e66ed12ad17d57e016b4db5bdc720 Branch:master (Windows 7)
2018-01-21 11:42:10 INFO    ::MAIN: #########################################################
2018-01-21 11:42:10 INFO    ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
2018-01-21 11:42:10 INFO    ::MAIN: #########################################################
2018-01-21 11:42:10 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\\Download\\|3D Preview Cars 3 2017 720p DD5.1 x264-Youtube.mkv|movie|fb0ddb376166e4bd083beb8b6a3d9227832ad49f']
2018-01-21 11:42:10 WARNING ::MAIN: Invalid number of arguments received from client, Switching to manual run mode ...
clinton-hall commented 6 years ago

try

cd C:\Scripts\nzbToMedia
C:\Program Files\Git\bin\git.exe checkout nightly
C:\Program Files\Git\bin\git.exe pull

that should put you onto nightly.

clinton-hall commented 6 years ago

I have now added qbittorrent client...

[Torrent]
    qBittorrenHost = localhost
    qBittorrentPort = 8080
    qBittorrentUSR = your username
    qBittorrentPWD = your password

this should allow for pausing, resuming, and deleting once done (if wanted)

Th3MadHatter commented 6 years ago

So far so good, well, almost. I've been testing a few things now.

But it fails to connect to the webui


2018-01-22 01:27:25 DEBUG   ::MAIN: Connecting to qbittorrent: http://localhost:48134
2018-01-22 01:27:25 ERROR   ::MAIN: Failed to connect to qBittorrent

With this config


    ###### qBittorrent (You must edit this if your using TorrentToMedia.py with qBittorrent)
    qBittorrenHost = localhost
    qBittorrentPort = 48134
    qBittorrentUSR = <User>
    qBittorrentPWD = <Password>

Trying to go to it manually and logging in works fine, everything done with auto-type so no spelling errors.

It passes everything through now and so far the parameters seem to be good, but then it goes a bit off failing to pauze and start and not picking up the right files.

2018-01-22 01:27:25 INFO    ::MAIN: #########################################################
2018-01-22 01:27:25 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\\Download\\|3D Preview Cars 3 2017 720p DD5.1 x264-Youtube.mkv|movie|fb033b376166e47d083bea8b6eefd9227832ad49f']
2018-01-22 01:27:25 DEBUG   ::MAIN: Adding TORRENT download info for directory L:\Download to database
2018-01-22 01:27:25 DEBUG   ::MAIN: Received Directory: L:\Download | Name: Cars 2 2011 Hybrid 720p BluRay x264-EbP | Category: movie
2018-01-22 01:27:25 DEBUG   ::MAIN: SEARCH: Could not find the category: movie in the directory structure
2018-01-22 01:27:25 INFO    ::MAIN: SEARCH: Found torrent directory 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube in input directory directory L:\Download
2018-01-22 01:27:25 INFO    ::MAIN: SEARCH: Setting inputDirectory to L:\Download\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:25 DEBUG   ::MAIN: Determined Directory: L:\Download\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube | Name: 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube | Category: movie
2018-01-22 01:27:25 INFO    ::MAIN: Auto-detected SECTION:CouchPotato
018-01-22 01:27:25 DEBUG   ::MAIN: Stopping torrent 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube while processing
2018-01-22 01:27:25 WARNING ::MAIN: Failed to stop torrent 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube in qbittorrent
2018-01-22 01:27:25 INFO    ::MAIN: Output directory set to: L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:25 DEBUG   ::MAIN: Scanning files in directory: L:\Download\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:25 DEBUG   ::MAIN: Found 1 files in L:\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:25 INFO    ::COPYLINK: MEDIAFILE: [3D Preview Cars 3 2017 720p DD5.1 x264-Youtube.mkv]
2018-01-22 01:27:25 INFO    ::COPYLINK: SOURCE FOLDER: [L:\Download\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube]
2018-01-22 01:27:25 INFO    ::COPYLINK: TARGET FOLDER: [L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube]
2018-01-22 01:27:25 INFO    ::COPYLINK: Hard linking SOURCE MEDIAFILE -> TARGET FOLDER
2018-01-22 01:27:29 DEBUG   ::MAIN: Checking for archives to extract in directory: L:\Download\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:30 INFO    ::MAIN: FLATTEN: Flattening directory: L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:30 DEBUG   ::MAIN: Checking for empty folders in:L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:30 INFO    ::MAIN: Found 1 media files in L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:30 INFO    ::MAIN: Calling CouchPotato:movie to post-process:3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:30 INFO    ::MAIN: Attemping imdbID lookup for 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:27:30 INFO    ::MAIN: Searching folder and file names for imdbID ...
2018-01-22 01:27:30 INFO    ::MAIN: Searching IMDB for imdbID ...
2018-01-22 01:27:31 DEBUG   ::MAIN: Opening URL: http://www.omdbapi.com
2018-01-22 01:27:31 DEBUG   ::SERVER: Attempting to connect to server at http://localhost:<Port>/api/
2018-01-22 01:27:33 DEBUG   ::SERVER: Server responded at http://localhost:<Port>/api/
2018-01-22 01:27:33 DEBUG   ::MAIN: Opening URL: http://localhost:<Port>/api//media.list with PARAMS: {}
2018-01-22 01:28:11 DEBUG   ::COUCHPOTATO: Opening URL: http://localhost:<Port>/api/<my api>/renamer.scan with PARAMS: {'download_id': u'070c511b586e266b465aeff063746e1b88d71ab1d5', 'media_folder': 'L:\\Process\\movie\\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube', 'downloader': 'qbittorrent'}
2018-01-22 01:28:11 POSTPROCESS::COUCHPOTATO: Starting renamer scan for 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:28:56 POSTPROCESS::COUCHPOTATO: SUCCESS: Finished renamer scan for folder L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:28:56 POSTPROCESS::COUCHPOTATO: Checking for status change, please stand by ...
2018-01-22 01:28:56 DEBUG   ::MAIN: Opening URL: http://localhost:<Port>/api/<My api>/media.list with PARAMS: {}
2018-01-22 01:29:08 POSTPROCESS::COUCHPOTATO: SUCCESS: Movie None has now been added to CouchPotato
2018-01-22 01:29:08 DEBUG   ::MAIN: Starting torrent 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube in qbittorrent
2018-01-22 01:29:08 WARNING ::MAIN: Failed to start torrent 3D Preview Cars 3 2017 720p DD5.1 x264-Youtube in qbittorrent
2018-01-22 01:29:08 INFO    ::CLEANDIR: Doing Forceful Clean of L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:29:08 INFO    ::MAIN: Deleting L:\Process\movie\3D Preview Cars 3 2017 720p DD5.1 x264-Youtube
2018-01-22 01:29:08 INFO    ::MAIN: The C:/Scripts/nzbToMedia/TorrentToMedia.py script completed successfully.

For some reason couchpotato doesn't get the right parameters because everything gets processed as None and then labled as (1969) to the nfo(?) file making it show up like that.

So it almost works flawlessly, really close, great job :+1: @

Edit: The failed start and stop might have something to do with the use of some sort of intranet structure used by qBt, the only reason I noticed is because I tried opening it in a handful of test browsers including an old version of windows Internet Explorer which reported it not showing intranet by default, this might be the cause of it not working by default and has to be worked around or accepted. That's my best guess on that subject.

Edit: Not everything seems to be labeled as (1969) files connected with .'s in between like 3D.Preview.Cars.3 seem to show up with their proper year.

clinton-hall commented 6 years ago

ok, in qBittorrent, how have you configured the webui? under options, you need to go to the 7th item on the left-hand frame. Then on the right hand side you need to enable Web User Interface (remote Control) byt default this has the port set to 8080 (not 48134 as your settings above). Also, ssl is not currently and option for this script. then put your user and pass into the authentication fields.

With these set, this should allow the script to pause and resume the torrents. I'm looking in to the issue where CP isn't matching the download ID to correctly identify the movie.

clinton-hall commented 6 years ago

the script appears to be connecting to qBittorrent ok here. once this works I am hoping this will allow for better matching to CouchPotato.

Th3MadHatter commented 6 years ago

I set up the entire qBt webui already so Web User Interface (remote Control) was already enabled and the user and password where set before I posted the previous message. The port it passes through is correct, I changed it because I've got too many daemons listening and traffic passing through on 8080 so to avoid interference I set it to this unused port. I don't see the use of SSL in my log, am I missing something? Because I didn't enable it. It's still failing to connect in TorrentToMedia. I can however log in to the webui on most browsers I tested and since I don't have any issues with utorrent>TTM nothing is blocking python>http commands.

The only thing I could try is to set Bypass authentication for clients on local host it's not a great option but maybe a work around.

I'll wait until after you read this and then run some other tests to see how couchpotato is picking up the files I give it.

clinton-hall commented 6 years ago

Try again... this was a stupid error at my end. I only mentioned ssl in case you had enabled https on the qBt webui (along with a custom port). Just wanted to rule out any of these additional features. Obviously ssl can be added later, but I'm trying to test the basic function first.

Th3MadHatter commented 6 years ago

Almost, it now works with qbt, I turned on the Bypass authentication on local host because whatever this runs locally anyway so i'm not exactly sure how well it works but I'll find out eventually, for now it starts and stops things perfectly. It still doesn't play well with couchpotato parameters, or at all really. It seems like it passes some but doesn't seem to get adopted. Finishes with None.

2018-01-23 06:27:21 DEBUG   ::MAIN: Connecting to qbittorrent: http://localhost:48134 
2018-01-23 06:27:21 INFO    ::MAIN: #########################################################
2018-01-23 06:27:21 INFO    ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
2018-01-23 06:27:21 INFO    ::MAIN: #########################################################
2018-01-23 06:27:21 DEBUG   ::MAIN: Options passed into TorrentToMedia: ['C:/Scripts/nzbToMedia/TorrentToMedia.py', 'L:\\Download\\|Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv|movie|077deeee2f74a9ed111d5d6409ba01f4e22fd2346']
2018-01-23 06:27:21 DEBUG   ::MAIN: Adding TORRENT download info for directory L:\Download to database
2018-01-23 06:27:22 DEBUG   ::MAIN: Received Directory: L:\Download | Name: Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv | Category: movie
2018-01-23 06:27:22 DEBUG   ::MAIN: SEARCH: Could not find the category: movie in the directory structure
2018-01-23 06:27:22 INFO    ::MAIN: SEARCH: Found torrent file Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv in input directory directory L:\Download
2018-01-23 06:27:22 INFO    ::MAIN: SEARCH: Setting inputDirectory to L:\Download\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:22 DEBUG   ::MAIN: Determined Directory: L:\Download\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv | Name: Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv | Category: movie
2018-01-23 06:27:22 INFO    ::MAIN: Auto-detected SECTION:CouchPotato
2018-01-23 06:27:22 DEBUG   ::MAIN: Stopping torrent Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv in qbittorrent while processing
2018-01-23 06:27:27 INFO    ::MAIN: Output directory set to: L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:27 DEBUG   ::MAIN: Scanning files in directory: L:\Download\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:28 DEBUG   ::MAIN: Found 1 files in L:\Download\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:28 INFO    ::COPYLINK: MEDIAFILE: [Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv]
2018-01-23 06:27:28 INFO    ::COPYLINK: SOURCE FOLDER: [L:\Download]
2018-01-23 06:27:28 INFO    ::COPYLINK: TARGET FOLDER: [L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv]
2018-01-23 06:27:28 INFO    ::COPYLINK: Hard linking SOURCE MEDIAFILE -> TARGET FOLDER
2018-01-23 06:27:33 DEBUG   ::MAIN: Checking for archives to extract in directory: L:\Download\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:34 INFO    ::MAIN: FLATTEN: Flattening directory: L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:34 DEBUG   ::MAIN: Checking for empty folders in:L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:34 INFO    ::MAIN: Found 1 media files in L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:34 INFO    ::MAIN: Calling CouchPotato:movie to post-process:Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:34 INFO    ::MAIN: Attemping imdbID lookup for Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:27:34 INFO    ::MAIN: Searching folder and file names for imdbID ...
2018-01-23 06:27:34 INFO    ::MAIN: Searching IMDB for imdbID ...
2018-01-23 06:27:35 DEBUG   ::MAIN: Opening URL: http://www.omdbapi.com
2018-01-23 06:27:35 DEBUG   ::SERVER: Attempting to connect to server at http://localhost:<Port>/api/<Api>/
2018-01-23 06:27:36 DEBUG   ::SERVER: Server responded at http://localhost:<Port>/api/<Api>/
2018-01-23 06:27:36 DEBUG   ::MAIN: Opening URL: http://localhost:<Port>/api/<Api>/media.list with PARAMS: {}
2018-01-23 06:27:56 DEBUG   ::COUCHPOTATO: Opening URL: http://localhost:<Port>/api/<Api>/renamer.scan with PARAMS: {'download_id': u'077deeee2f74a9ed111d5d6409ba01f4e22fd2346', 'media_folder': 'L:\\Process\\movie\\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv', 'downloader': 'qbittorrent'}
2018-01-23 06:27:56 POSTPROCESS::COUCHPOTATO: Starting renamer scan for Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:28:13 POSTPROCESS::COUCHPOTATO: SUCCESS: Finished renamer scan for folder L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:28:13 POSTPROCESS::COUCHPOTATO: Checking for status change, please stand by ...
2018-01-23 06:28:13 DEBUG   ::MAIN: Opening URL: http://localhost:<Port>/api/<Api>/media.list with PARAMS: {}
2018-01-23 06:28:16 POSTPROCESS::COUCHPOTATO: SUCCESS: Movie None has now been added to CouchPotato
2018-01-23 06:28:16 DEBUG   ::MAIN: Starting torrent Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv in qbittorrent
2018-01-23 06:28:21 INFO    ::CLEANDIR: Doing Forceful Clean of L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:28:21 INFO    ::MAIN: Deleting L:\Process\movie\Test.Movie.2017.NOR.720p.BluRay.AC3.x264-Youtube.mkv
2018-01-23 06:28:22 INFO    ::MAIN: The C:/Scripts/nzbToMedia/TorrentToMedia.py script completed successfully.
clinton-hall commented 6 years ago

can you confirm that this movie was snatched by CouchPotato? It seems strange that none of the download IDs match, the script can't determine the imdb_id and CouchPotato can't determine the imdb_id either...

Th3MadHatter commented 6 years ago

Yes tried it with about 4 different titles now. I let all of them auto snatch by CouchPotato, it adds them as snatched to the list, downloads and runs the PP script. Eventually they get added because the managed movies directory is scanned but I have to manually mark them as complete and move to library to make them go away.