Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bw_plex watch errors #34

Closed
notnicecream opened this issue May 23, 2018 · 40 comments
Closed

bw_plex watch errors #34

notnicecream opened this issue May 23, 2018 · 40 comments

Comments

@notnicecream
Copy link

Hi, I've installed everything that was required and I've setup the config file to what I believe is correct.
So I've tried running bw_plex watch but I'm getting these errors.

I'm on Windows 7.

File "c:\Python27\Scripts\bw_plex-script.py", line 11, in <module> load_entry_point('bw-plex', 'console_scripts', 'bw_plex')() File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__ return self.main(*args, **kwargs) File "c:\python27\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "c:\python27\lib\site-packages\click\core.py", line 1063, in invoke Command.invoke(self, ctx) File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "c:\users\patrick\src\bw-plex\bw_plex\plex.py", line 176, in cli verify_ssl=verify_ssl) File "c:\users\patrick\src\bw-plex\bw_plex\misc.py", line 44, in get_pms PMS = PlexServer(url, token, sess) File "c:\python27\lib\site-packages\plexapi\server.py", line 102, in __init_ data = self.query(self.key, timeout=timeout) File "c:\python27\lib\site-packages\plexapi\server.py", line 348, in query return ElementTree.fromstring(data) if data.strip() else None File "<string>", line 124, in XML lementTree.ParseError: not well-formed (invalid token): line 20, column 56

Then I tried installing pip again incase something was missing and I got these errors.

File "c:\Python27\Scripts\bw_plex-script.py", line 11, in <module> load_entry_point('bw-plex', 'console_scripts', 'bw_plex')() File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__ return self.main(*args, **kwargs) File "c:\python27\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "c:\python27\lib\site-packages\click\core.py", line 1063, in invoke Command.invoke(self, ctx) File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "c:\users\patrick\src\bw-plex\bw_plex\plex.py", line 176, in cli verify_ssl=verify_ssl) File "c:\users\patrick\src\bw-plex\bw_plex\misc.py", line 44, in get_pms PMS = PlexServer(url, token, sess) File "c:\python27\lib\site-packages\plexapi\server.py", line 102, in __init_ data = self.query(self.key, timeout=timeout) File "c:\python27\lib\site-packages\plexapi\server.py", line 348, in query return ElementTree.fromstring(data) if data.strip() else None File "<string>", line 124, in XML lementTree.ParseError: not well-formed (invalid token): line 20, column 56

@Hellowlol
Copy link
Owner

Thanks for trying. This is a parser error while trying to logon to your plex server. Can you double check your config file
url needs to be in: http://ip:port
and token is simpley the token. https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/

@notnicecream
Copy link
Author

I seem to have fixed the config I believe.

but I'm getting Aborted! now

`PS C:\Users\patrick> bw_plex watch
2018-05-23 17:43:08,868 :: bw_plex :: DEBUG :: Getting server patrick-PC
2018-05-23 17:43:08,871 :: bw_plex :: DEBUG :: Getting hashtable
2018-05-23 17:43:09,953 :: bw_plex :: INFO :: Loading existing files in db

Aborted!
PS C:\Users\patrick> bw_plex watch
2018-05-23 18:56:37,944 :: bw_plex :: DEBUG :: Getting server patrick-PC
2018-05-23 18:56:37,946 :: bw_plex :: DEBUG :: Getting hashtable
2018-05-23 18:56:39,048 :: bw_plex :: INFO :: Loading existing files in db

Aborted!`

@Hellowlol
Copy link
Owner

It’s just to given you a notice that you have cancel the cli using control c. Try letting it run for a while

@notnicecream
Copy link
Author

it gives me that aborted! immediately after typing in bw_plex watch without touching anything else.

@Hellowlol
Copy link
Owner

Hellowlol commented May 24, 2018

Hm, i have no idea why that happens. Can you try to upgrade bw_plex? pip install -U bw_plex
Delete the hashes.pklz file and try again.
What python version is this? Is it 64 or 32 bit? You can find this by executing python -V in cmd/shell
What happens if you try another command line bw_plex process -n SOME_SHOW_NAME?

@notnicecream
Copy link
Author

2.7.13 python version, 64 bit

So, I tried pip install -U bw_plex and it just said 'Requirement not upgraded as not directly required:'
for everything.

Then I deleted the hashes.pklz and tried bw_plex watch again and I'm getting the first error in my first post again with the parser errors.

I try bw_plex watch again. I'm getting the second errors saying its !aborted. So I'm guessing I somehow don't have my config file correct.

I tried bw_plex process -n Archer since I know I have some of those episodes.
It displays

2018-05-24 09:51:46,634 :: bw_plex :: DEBUG :: Getting server patrick-PC

0 Archer (2009)

Select what show to process:

I click 0 and it brings up the episodes, I click the number for the episode and I get the same error below.

2018-05-24 09:57:06,131 :: bw_plex :: DEBUG :: Getting hashtable
2018-05-24 09:57:06,375 :: bw_plex :: INFO :: Loading existing files in db

Aborted!

I'll give a general idea of what my config file looks like without giving away my info and you let me know if something is out of place.

url = http://ip:port
token = mytoken
verify_ssl = False
servername = patrick-PC
debug = False
username = myusername
password = mypassword
thread_pool_number = 10
check_for_theme_sec = 600
words = previously on, last season, last episode
ignore_show = ,
level = debug
users = ,
clients = ,
mode = skip_only_theme
theme_source = all
check_credits = False
check_credits_action = 
check_credits_start_next_ep = True
check_credits_sec = 120
process_recently_added = False
process_deleted = False

I'll keep fiddling with it and seeing if something else works.

@Hellowlol
Copy link
Owner

Config looks good. I don’t get why this happens. Only think I could think on some exceptions getting swallowed while loading the hash table. Is there any themes in the theme and temp themes folder if so can you delete them and the hashtable file and try to run the program in cmd.exe? If this doesn’t I’ll work I’ll write a branch with more logging

@notnicecream
Copy link
Author

Nothing in either theme folder sadly. Let me know if you update the branch, Thanks!

@Hellowlol
Copy link
Owner

Can you post the full log in a gist? Just make sure you replaces any tokens (I plan to add a sanitation to the log later)

@notnicecream
Copy link
Author

These are the only logs I found in your .config folder https://gist.github.com/notnicecream/5873fcf2ac29980fc16726d0f2597c93

But I also copied over the errors from my cmd to this gist for you as well
https://gist.github.com/notnicecream/38b88f312acfdff930973f84073515c2

@Hellowlol
Copy link
Owner

Hellowlol commented May 24, 2018

Awesome. The logs indicate a memory errror (generally this means you have to little memory in general or that the process used to much memory. How much memory do you have on your computer? Do you have several python versions installed? Python 32 and 64 bit python 3 and python 2?
What happens if you do python plex.py watch ? (Remove hashes.pklz file first)

@notnicecream
Copy link
Author

I have 16gbs of memory, I had around 7gbs of free memory when I first tried it. I stopped running everything else just incase it needed more than 7gbs and its still giving the same memory error.

I'm 95% sure I only have python 2.7 64bit

As for running python plex.py watch, it's giving me basically the same error, see below.

PS C:\Users\patrick\src\bw-plex\bw_plex> python plex.py watch
2018-05-24 13:25:17,246 :: bw_plex :: DEBUG :: Getting server patrick-PC
2018-05-24 13:25:17,247 :: bw_plex :: DEBUG :: Getting hashtable
2018-05-24 13:25:17,486 :: bw_plex :: INFO :: Creating new hashtable db
2018-05-24 13:25:17,487 :: bw_plex :: DEBUG :: Saving HashTable
Traceback (most recent call last):
  File "plex.py", line 924, in <module>
    cli()
  File "c:\Python27\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\Python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\Python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\Python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\Python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "plex.py", line 858, in watch
    HT = get_hashtable()
  File "c:\users\patrick\src\bw-plex\bw_plex\misc.py", line 650, in get_hashtable
    HT.save(FP_HASHES)
  File "c:\users\patrick\src\bw-plex\bw_plex\misc.py", line 596, in save
    pickle.dump(self, f, pickle.HIGHEST_PROTOCOL)
MemoryError

@Hellowlol
Copy link
Owner

If you just write python in cmd it should start idle. The version type is listed at the top. Highest memory usage I have seen so far is around 2 gb. 7 should be plenty.

@notnicecream
Copy link
Author

Ok, so I had 32 bit python apparently. I went on to uninstall everything and reinstall everything but using python 64 bit 2.7.15.

It seems to be running now. the only thing is I get the warning below.

2018-05-24 15:23:29,144 :: bw_plex :: WARNING :: Scanning for credits is not supported. Install the package with pip ins
tall bw_plex[all] or bw_plex[video]
2018-05-24 15:23:29,167 :: bw_plex :: WARNING :: Extracting text from images is not supported. Install the package with
pip install bw_plex[all] or bw_plex[video]

I tried doing pip install bw_plex[all] but it says everything is already downloaded.

But besides the warning it is now finding what show I am watching, granted I've only tried a few shows so far but they are all saying

Failed to find ratingkey 16975 in the db

All different rating key numbers but they all fail. and it doesn't skip any intro's or credits yet, so i'll keep at it trying to figure out what to do.

@Hellowlol
Copy link
Owner

Hellowlol commented May 24, 2018

Try doing pip install -U bw_plex[all]
Some of the optional package can be abit painfull to install so i have made something optional in order to make it simpler to test (install).

As for the message Failed to find ratingkey 16975 in the db that just to let you know that bw_plex has never seen that file before. And as a result it should start downloading and analyze that episode (and the next one) to figure out when the intro starts and ends. You just need to wait until the message Added showname sxx eyy to db. Then you can start playback on that item and see it it skips as it should.

@notnicecream
Copy link
Author

I tried pip install -U bw_plex[all]
It didn't seem to download anything new for myself it's just saying Requirement not upgraded as not directly required

How long does it usually take to analyze and add a show? Because I've had it running for over a day now and it hasn't said anything besides Failed to find ratingkey 16975 in the db on any episode I start watching.

Thanks for the help so far, I appreciate it.

@Hellowlol
Copy link
Owner

Hellowlol commented May 25, 2018

That depends on how big the file we analyze what what you want to analyze, when i do it on my i7, it usually takes like 2-4 minutes for each item.
Try hitting control c one time and see if you you get some traceback or something. if you do please post it.
BTW: ffmpeg is in your sys path? check that you can call ffmpeg from cmd.exe
You should see stuff in the console, like:

2018-05-24 22:47:30,194 :: bw_plex :: DEBUG :: Failed to find ratingkey 34402 in the db
2018-05-24 22:47:30,394 :: bw_plex :: DEBUG :: Download the first 10 minutes of The.Arrangement.(2017).s02e04 as .wav
2018-05-24 22:47:30,410 :: bw_plex :: DEBUG :: Checking if we can reach The.Arrangement.(2017).s02e04 directly
2018-05-24 22:47:30,442 :: bw_plex :: WARNING :: Downloading from pms..
2018-05-24 22:47:30,486 :: bw_plex :: DEBUG :: calling ffmpeg with ffmpeg -i http://10.0.0.22:32400/library/parts/42120/1522657929/file.mkv?download=1&X-Plex-Token=<TOKEN>-ac 1 -ar 11025 -ss 0 -t 600 -acodec pcm_s16le C:\Users\alexa\AppData\Local\Temp\offset_07byy7ao.wav
....
....

@notnicecream
Copy link
Author

I have an I7 as well, and I checked ffmpeg on my cmd.exe and it's working as well.

I kept it running all weekend hoping it would maybe start working. But it's just the same.

2018-05-25 16:18:55,805 :: bw_plex :: DEBUG :: Failed to find ratingkey 6522 in the db
2018-05-25 16:18:55,831 :: bw_plex :: DEBUG :: Download the first 10 minutes of Archer.(2009).s06e05 as .wav
2018-05-25 16:18:55,832 :: bw_plex :: DEBUG :: Checking if we can reach Archer.(2009).s06e05 directly
2018-05-25 16:18:55,832 :: bw_plex :: DEBUG :: Found E:\Plex Video Files\movies_tv\tv\Archer (2009)\Season 06\Archer (2009) - S06E05 - Vision Quest HDTV-1080p.m4v

Eventually near the end it just stopped even trying. Just outputting this without even trying to download the first 10 minutes.

2018-05-25 21:23:15,437 :: bw_plex :: DEBUG :: Failed to find ratingkey 21514 in the db
2018-05-27 20:19:02,871 :: bw_plex :: DEBUG :: Failed to find ratingkey 21499 in the db

Not really sure what else to do.

@Hellowlol
Copy link
Owner

Can you post the entire log to a gist? remember to remove any plex-api token.

@notnicecream
Copy link
Author

@Hellowlol
Copy link
Owner

Thanks, so it reaches process_to_db then "nothing happens" so, can you try to run
bw_plex process -n Archer
select the archer using the number press enter then select the first episode and see what happens (remove the log, the hashes file and media.db first) then post the log again.

@notnicecream
Copy link
Author

ok, here's the gist file of what happened. https://gist.github.com/notnicecream/7db906d207770e47a3c22e16332737cb

@Hellowlol
Copy link
Owner

Ok, i have no idea why that happend.

Are you using the version on pypi or from github? If its not from github
pip uninstall bw_plex

git clone https://github.com/Hellowlol/bw_plex.git
enter the folder
python setup.py install -e . (note the dot)
cd into the bw_plex subfolder then do python plex.py process -n Acher

Your my hero, thanks :)

@notnicecream
Copy link
Author

Here's my most recent gist :) https://gist.github.com/notnicecream/e76bdb3bb0497f10aac9e19aab956bf8

I have no problem testing stuff, I just don't have much if at all experience with python so I'm winging it.

@Hellowlol
Copy link
Owner

Hellowlol commented May 28, 2018

Sorry, it was pip install -e . Not python setup.py -e . Sorry my bad. Remember to remove media.db hashes.pklz and the log before you try again.

@notnicecream
Copy link
Author

@Hellowlol
Copy link
Owner

Hellowlol commented May 29, 2018

Only thing i can think if is a ffmeg error. Can you try to execute:
ffmpeg -i http://24.146.21.144:32400/library/metadata/6488/theme/1527137051?X-Plex-Token=<YOUR TOKEN HEREE> -ac 1 -ar 11025 -acodec pcm_s16le archer.wav

and see what it returns/does ? If this doesnt work ill have to create a new branch with additional logging.

@notnicecream
Copy link
Author

Looks like that did something. here - https://gist.github.com/notnicecream/5fcfc63a6defac7a9410e174810b9845

@Hellowlol
Copy link
Owner

Hm, we should catch more info now. Delete log, hashes and media.db. do a git pull and then do:

bw_plex process -n Archer
select the archer using the number press enter then select the first episode and see what happens

@notnicecream
Copy link
Author

@stiangus
Copy link

I got that exact same error earlier today. TypeError: unsupported operand type(s) for -: 'str' and 'int'
The only thing that helped was removing my entire .config/bw_plex folder and then running plex.py again to let it create everything in a fresh folder.
Deleting just logs, hashes and media.db resulted in the same error, I had to remove config.ini, temp_themes and themes aswell.
Just backup the config.ini and restore it later. Might be a fluke in my case, but maybe it needs to create a new config after install or something?

@Hellowlol
Copy link
Owner

I have forced that value to int now. Dunno why it happened

@notnicecream
Copy link
Author

I tried deleting a couple things. I believe the error TypeError: unsupported operand type(s) for -: 'str' and 'int'
was happening because you updated the config file, I looked at it and copied all the information then updated your bw_plex and the new config was very different. So I updated the info and tried again.

Sadly it's mostly the same scenario, still getting this error when trying to run bw_plex process -n Archer https://gist.github.com/notnicecream/8079aef424898308afb13b8e643c272b

It seems to be creating video files in the Themes folder and bw_plex watch isn't giving any errors but it's still not skipping any intro/outro credits.

@Hellowlol
Copy link
Owner

The version your using dont have addition logging, there is also a bug where that make this uncompat with python 2 (what your using.)

To fix this your need to update the package from github. Delete log, hashes.pklz and the db (there was some db changes) and do:
git pull

@notnicecream
Copy link
Author

Ionno, I've reinstalled everything again.

Here's the Gist - https://gist.github.com/notnicecream/e81817938b938ff2f167e459bfde41e7

@Hellowlol
Copy link
Owner

Hellowlol commented Jun 2, 2018

Nothing usefull in the log (the same error). Okei i have created a new branch where we dont to any threading, this should show the entire traceback. Since you have installed from source you should be able to just use git.

git pull
git checkout ffs
cd bw_plex
python plex.py test_show archer -s 6 -e 1

@Hellowlol
Copy link
Owner

Docker support was just added. :)

@Hellowlol
Copy link
Owner

The only time I have encountered a quick exit is if there is a hashes.plkz file but it’s like 1 kB. Try the docker

@notnicecream
Copy link
Author

I tried it again. removed everything started from scratch, getting these errors when I run bw_plex watch.
https://gist.github.com/notnicecream/a3c89274d20dfa7792b604a0c7ba9d82

@Hellowlol
Copy link
Owner

Still the same issue as before. If can’t find llvmlite.dll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants