Hellowlol / bw_plex

binge watching for plex
MIT License
368 stars 23 forks source link

Roku3 Requiring A Hail Mary To Connect? #78

Closed ThisGuyNeedsABeer closed 5 years ago

ThisGuyNeedsABeer commented 5 years ago

I installed from git and configured my settings in the config.ini file as follows

url = http://10.0.0.100:32400 token = <PMS-X-TOKEN-FROM-XML> verify_ssl = False name = <PMS-NAME> username = <PMS-USER> password = <PMS-PASS>

And it looks like everything connects. I start streaming a file and it looks like it processes it but no intro skip button, or action occurs on a Roku 3. Below is what output I could snag, not sure if this is enough.

2019-03-07 01:48:45,664 :: bw_plex :: WARNING :: plex.py:747 :: Downloading from pms.. 2019-03-07 01:48:45,664 :: bw_plex :: DEBUG :: misc.py:283 :: Calling find_offset_ffmpeg with command ffmpeg -i http://10.0.0.100:32400/library/parts/80801/1551371727/file.mkv?download=1&X-Plex-Token=<hidden> -t 600 -vf blackdetect=d=0.5:pix_th=0.1 -af silencedetect=n=-50dB:d=0.3 -f null - 2019-03-07 01:49:26,263 :: bw_plex :: DEBUG :: plex.py:1023 :: Failed to find ratingkey 10585 in the db 2019-03-07 01:49:26,285 :: bw_plex :: DEBUG :: plex.py:896 :: Found <TV-SHOW>!.s15e01 2019-03-07 01:49:26,285 :: bw_plex :: DEBUG :: plex.py:901 :: Download the first 10 minutes of <TV-SHOW>!.s15e01 as .wav 2019-03-07 01:49:26,286 :: bw_plex :: DEBUG :: plex.py:727 :: Checking if we can reach <TV-SHOW>!.s15e01 directly 2019-03-07 01:49:26,286 :: bw_plex :: WARNING :: plex.py:747 :: Downloading from pms.. 2019-03-07 01:49:26,286 :: bw_plex :: DEBUG :: misc.py:380 :: calling ffmpeg with ffmpeg -i http://10.0.0.100:32400/library/parts/25171/1518555306/file.mkv?download=1&X-Plex-Token=<hidden> -ac 1 -ar 11025 -ss 0 -t 600 -acodec pcm_s16le /tmp/offset_h6vgj1oy.wav 2019-03-07 01:49:34,648 :: bw_plex :: DEBUG :: misc.py:402 :: Done converting /tmp/offset_h6vgj1oy.wav 2019-03-07 01:49:34,649 :: bw_plex :: DEBUG :: misc.py:690 :: <TV-SHOW>! has 0 themes 2019-03-07 01:49:34,649 :: bw_plex :: DEBUG :: plex.py:107 :: downloading theme from process_to_db 2019-03-07 01:49:34,650 :: bw_plex :: DEBUG :: misc.py:452 :: Searching search_tunes for <TV-SHOW>! using rk 10520 2019-03-07 01:49:35,124 :: bw_plex :: DEBUG :: misc.py:467 :: http://www.televisiontunes.com/search.php?q=<TV-SHOW>%21 2019-03-07 01:49:35,269 :: bw_plex :: DEBUG :: misc.py:502 :: Searching youtube for name <TV-SHOW>! rk 10520 save_path /root/.config/bw_plex/themes url None 2019-03-07 01:49:39,312 :: bw_plex :: DEBUG :: misc.py:615 :: Download theme using source http://10.0.0.100:32400/library/metadata/10520/theme/1551850852?X-Plex-Token=<hidden> 2019-03-07 01:49:39,314 :: bw_plex :: DEBUG :: misc.py:380 :: calling ffmpeg with ffmpeg -i http://10.0.0.100:32400/library/metadata/10520/theme/1551850852?X-Plex-Token=<hidden> -ac 1 -ar 11025 -acodec pcm_s16le /tmp/offset_u616f75x.wav 2019-03-07 01:49:39,812 :: bw_plex :: DEBUG :: misc.py:399 :: Done converted and moved /root/.config/bw_plex/themes/<TV-SHOW>!__10520__1551923379.wav to /root/.config/bw_plex/themes 2019-03-07 01:49:41,682 :: bw_plex :: DEBUG :: misc.py:615 :: Download theme using source /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav 2019-03-07 01:49:41,684 :: bw_plex :: DEBUG :: misc.py:380 :: calling ffmpeg with ffmpeg -i /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav -ac 1 -ar 11025 -acodec pcm_s16le /tmp/offset_3u58m5u3.wav 2019-03-07 01:49:41,912 :: bw_plex :: DEBUG :: misc.py:399 :: Done converted and moved /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav to /root/.config/bw_plex/themes 2019-03-07 01:49:43,398 :: bw_plex :: DEBUG :: plex.py:111 :: Started to process <TV-SHOW>!.s15e01 2019-03-07 01:49:45,948 :: bw_plex :: DEBUG :: misc.py:218 :: final_video [] 2019-03-07 01:49:45,949 :: bw_plex :: DEBUG :: misc.py:219 :: final_audio [['-1:59', '00:00', '00:00'], ['07:14', '07:15', '00:00'], ['07:58', '07:58', '00:00'], ['08:04', '08:05', '00:00'], ['08:08', '08:09', '00:00'], ['08:09', '08:09', '00:00'], ['08:10', '08:11', '00:00'], ['08:12', '08:13', '00:00'], ['08:13', '08:14', '00:00'], ['08:14', '08:14', '00:00'], ['08:19', '08:20', '00:01'], ['08:22', '08:22', '00:00'], ['08:23', '08:24', '00:00'], ['08:57', '08:57', '00:00']] 2019-03-07 01:49:45,950 :: bw_plex :: DEBUG :: misc.py:221 :: fin v [] 2019-03-07 01:49:45,950 :: bw_plex :: DEBUG :: misc.py:222 :: fin a [[-0.0015, 0.532833, 0.534333], [434.387, 435.135, 0.748], [478.206, 478.933, 0.727333], [484.649, 485.631, 0.982], [488.873, 489.3, 0.427667], [489.47, 489.77, 0.3], [490.664, 491.007, 0.343], [492.776, 493.119, 0.342667], [493.715, 494.164, 0.449], [494.163, 494.655, 0.492], [499.625, 500.949, 1.324], [502.525, 502.89, 0.364667], [503.316, 504.128, 0.812], [537.172, 537.685, 0.513667]] 2019-03-07 01:49:45,998 :: bw_plex :: DEBUG :: misc.py:728 :: Downloading subtitle from PMS 2019-03-07 01:49:52,116 :: bw_plex :: DEBUG :: plex.py:909 :: Deleted /tmp/offset_7i721ml8.wav 2019-03-07 01:49:52,116 :: bw_plex :: DEBUG :: misc.py:89 :: Check if we can find the next media item. hu Mar 7 01:52:16 2019 Analyzed #1 /tmp/offset_tj8hhbtb.wav of 599.818 s to 110814 hashes 2019-03-07 01:52:18,261 :: bw_plex :: DEBUG :: plex.py:986 :: Found <TV-SHOW>!.s15e01 theme start 01:24, theme end 01:51, ffmpeg_end 03:43 progress 01:28 best_time 01:51 credits_start 00:00 credits_end 00:00 2019-03-07 01:52:18,262 :: bw_plex :: DEBUG :: plex.py:1017 :: <TV-SHOW>!.s15e01 is in the correct time range theme_end 2019-03-07 01:52:18,262 :: bw_plex :: DEBUG :: plex.py:973 :: Called jump with <TV-SHOW>!.s15e01 30 111.64154195011338 None 2019-03-07 01:52:18,265 :: bw_plex :: INFO :: plex.py:767 :: Called client_action with 111.64154195011338 01:51 30 None 2019-03-07 01:52:18,281 :: bw_plex :: INFO :: plex.py:802 :: client Livingroom TV 88.0 2019-03-07 01:52:18,282 :: bw_plex :: INFO :: plex.py:821 :: 115infs3av5ofe8opmuoezs3 94849bb29b3f0bba5574cdca552be655 2019-03-07 01:52:18,286 :: bw_plex :: DEBUG :: plex.py:830 :: We couldnt match the client. Trying a hail marry. 2019-03-07 01:52:18,296 :: bw_plex :: INFO :: plex.py:835 :: Connectiong to Livingroom TV 2019-03-07 01:52:18,299 :: bw_plex :: ERROR :: plex.py:48 :: There was an exception in client_action Traceback (most recent call last): File "/app/bw_plex/bw_plex/plex.py", line 43, in inner return func(*args) File "/app/bw_plex/bw_plex/plex.py", line 836, in client_action correct_client.connect() File "/usr/local/lib/python3.6/dist-packages/plexapi/client.py", line 91, in connect data = self.query(self.key, timeout=timeout) File "/usr/local/lib/python3.6/dist-packages/plexapi/client.py", line 155, in query url = self.url(path) File "/usr/local/lib/python3.6/dist-packages/plexapi/client.py", line 201, in url raise BadRequest('PlexClient object missing baseurl.') plexapi.exceptions.BadRequest: PlexClient object missing baseurl. 2019-03-07 01:52:21,926 :: bw_plex :: DEBUG :: misc.py:180 :: Match 1 rank 0 aligntime -4804 theme song /root/.config/bw_plex/themes/<TV-SHOW>!__10520__1551923379.wav started at 112.45424036281179 (01:52) in ended at 139.7144671201814 (02:19) match length 27.260226757369615 in the video. Video was found in theme 0.905578231292517 ended at 28.16580498866213 confidence 0.5285439384220654 2019-03-07 01:52:21,926 :: bw_plex :: DEBUG :: misc.py:180 :: Match 2 rank 1 aligntime -4796 theme song /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav started at 112.82575963718821 (01:52) in ended at 133.12 (02:13) match length 20.29424036281179 in the video. Video was found in theme 1.4628571428571429 ended at 21.757097505668934 confidence 0.36460649177412185 2019-03-07 01:52:21,927 :: bw_plex :: DEBUG :: misc.py:180 :: Match 2 rank 1 aligntime -4799 theme song /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav started at 116.26231292517006 (01:56) in ended at 140.45750566893423 (02:20) match length 24.195192743764174 in the video. Video was found in theme 4.829750566893424 ended at 29.024943310657598 confidence 0.017785682525566917 2019-03-07 01:52:21,927 :: bw_plex :: DEBUG :: misc.py:180 :: Match 2 rank 1 aligntime -3962 theme song /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav started at 116.26231292517006 (01:56) in ended at 116.42485260770975 (01:56) match length 0.16253968253968254 in the video. Video was found in theme 24.264852607709752 ended at 24.427392290249433 confidence 0.0035571365051133837

What is the base URL that it is looking for? The command I ran to run was (as root) "bw_plex watch" per the reddit post I came across (https://www.reddit.com/r/PleX/comments/8l2wj6/looking_for_alpha_testers_for_skip_introoutro/)

Thanks for any help. Looks like a very promising project!

Edit:

Running as follows yields better output, but then it nothing happens after times are indeitifed (also my PMS seems to crash once bw_plex stops functioning) # bw_plex -u "<USERNAME>" -p "<PASSWORD>" -s "<SERVER>" --url "http://10.0.0.100:32400" -t "<TOKEN>" watch default folder set to %s /root/.config/bw_plex 2019-03-07 02:17:46,602 :: bw_plex :: INFO :: __init__.py:162 :: default folder set to /root/.config/bw_plex 2019-03-07 02:17:46,859 :: bw_plex :: DEBUG :: misc.py:64 :: Getting server <SERVER> 2019-03-07 02:17:46,860 :: bw_plex :: DEBUG :: misc.py:625 :: Getting hashtable 2019-03-07 02:17:46,951 :: bw_plex :: INFO :: misc.py:711 :: Loading existing files in db 2019-03-07 02:17:50,241 :: bw_plex :: DEBUG :: misc.py:640 :: Files in the hashtable 2019-03-07 02:17:50,242 :: bw_plex :: DEBUG :: misc.py:642 :: /root/.config/bw_plex/themes/<TV-SHOW>!__10520__1551923379.wav 2019-03-07 02:17:50,243 :: bw_plex :: DEBUG :: misc.py:642 :: /root/.config/bw_plex/themes/<TV-SHOW>__10520__1551923375.wav Watching for media on 2019-03-07 02:18:13,129 :: bw_plex :: DEBUG :: plex.py:986 :: Found <TV-SHOW>!.s15e10 theme start 01:17, theme end 01:45, ffmpeg_end 03:59 progress 00:00 best_time 01:45 credits_start 00:00 credits_end 00:00 2019-03-07 02:18:23,120 :: bw_plex :: DEBUG :: plex.py:986 :: Found <TV-SHOW>!.s15e10 theme start 01:17, theme end 01:45, ffmpeg_end 03:59 progress 00:10 best_time 01:45 credits_start 00:00 credits_end 00:00 2019-03-07 02:18:33,095 :: bw_plex :: DEBUG :: plex.py:986 :: Found <TV-SHOW>!.s15e10 theme start 01:17, theme end 01:45, ffmpeg_end 03:59 progress 00:20 best_time 01:45 credits_start 00:00 credits_end 00:00 2019-03-07 02:18:43,171 :: bw_plex :: DEBUG :: plex.py:986 :: Found <TV-SHOW>!.s15e10 theme start 01:17, theme end 01:45, ffmpeg_end 03:59 progress 00:30 best_time 01:45 credits_start 00:00 credits_end 00:00 2019-03-07 02:18:53,061 :: bw_plex :: DEBUG :: plex.py:986 :: Found <TV-SHOW>!.s15e10 theme start 01:17, theme end 01:45, ffmpeg_end 03:59 progress 00:40 best_time 01:45 credits_start 00:00 credits_end 00:00

Hellowlol commented 5 years ago

What happens is that we cant find the match the correct machineidentifier so it fails as the client does not have a baseurl (url the client). Note to self, we should catch this error BadRequest and retry using the server.

Please post the logs from the log file. Reading the console output was kinda painfull :P

Is the client on the same local network as the server?

I dont have a roku to test with. :(

ThisGuyNeedsABeer commented 5 years ago

My apologies, I was capturing it directly from an SSH terminal. Which log would you like (filename), I want to make sure I grab the right thing. It looks like it matches properly, and says where the credits start/end. I also tried with Plex Web as well and got the same result. Should I be running with the long command line of

"bw_plex -u "" -p "" -s "" --url "http://10.0.0.100:32400" -t "" watch"

or

"bw_plex watch" and relying on the config file?

I'm also not very clear on how it skips the credits, will a "skip intro" like button appear? I could look into possibly sending you a Roku 3 to test with if you'd be interested. What clients are known to be good working?

Thank you for the reply!

Hellowlol commented 5 years ago

The console arguments is just to provide a easy way to override the config and to support dockers. I recommend using the config file.

Skip credits will just stop playback when the credits is reached, depending on the settings it will also start playback on the next item. There is no skip button or something like this as nothing regarding this is done on the client (its on the computer that runs bw_plex).

I cant remember where the config file is, but if you start bw_plex you should get a msg default_folder is xxxx. I this is the folder where you can find your config file, theme songs, db etc.