beaston02 / CAM4Recorder

52 stars 75 forks source link

Duplicated Files #2

Open francisuk1989 opened 6 years ago

francisuk1989 commented 6 years ago

This has the same issue as https://github.com/beaston02/MFCRecorder/issues/11 where lots of streams are happening at once.

beaston02 commented 6 years ago

Thank you very much for posting this. I forgot to reply to your comment yesterday. I plan to fix this today. I will report back once it is done.

francisuk1989 commented 6 years ago

@beaston02 no worrys....but on that note i have tryed Ubuntu and Arch linux but experience the same issues...tryed slowing the the counter to 60 seconds but same.

Thanks for the speedy reply and look forward to the issue been resolved.

beaston02 commented 6 years ago

Yeah, I haven't looked at the code here, but I image it's the same as what was going on with the MFC script, which is models were being removed from the "recording" list when they shouldn't have been (bad while loop).

It should be a simple fix, I just need to get to my computer to do it :)

Also, I can't remember the last time I touched this script. If I never added a config file, I will do that, and maybe a couple of other things at the same time. Im still learning Python (coding in general) and I'm sure If can use some simple improvements throughout it!

francisuk1989 commented 6 years ago

Looking forward to the issues and improvements as always..The only thing i would like to see is a web interface but thats another time and day but understand we need to address the issue with the duplicated streams/files first.

Please keep this issue open and ill report back any duplicated issues (if i do) to here 👍

beaston02 commented 6 years ago

Sorry for the delay. I planned on having this done much earlier, but my dog managed to get a pretty deep cut to his leg while we were hiking today, so i lost some time to the unexpected vet visit!! haha.

Anyways, the issue should be fixed now, and I went ahead and added the config file, and settings to run a post processing script on completed files.

I did some cleaning up of the code, but not as much as I had planned to get done since my time was more limited. None of that should matter much though. It should be stable and should no longer have duplicate files :)

Im very much still learning coding, and the interface for MFC is really the first time ive done anything with that stuff. At the moment, its going to be the only one thats getting an interface until Im happy with where it is. I want to add more to it, clean it up some, and do a bit with some javascripting (Ive never done anything with javascripts, so more learning there too....). Once I feel happy with where it is, ill probably add similar to the other scripts, but will probably start with the most popular and work to the least popular, so I would not anticipate anything on this one for some time!

Ill leave this open so you can run it for some time and let me know if you see the duplicate recordings happening again.

francisuk1989 commented 6 years ago

i have a one issue with the script where is basicly trying to get the stream but maybe failed/user offline or possible goes private show but never seen this before?

if is private can the error be hidden also.

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, *self._kwargs) File "cam4.py", line 65, in startRecording .format(videoAppUrl, videoPlayUrl, str(int(time.time() 1000)))) File "/usr/local/lib/python3.5/dist-packages/livestreamer/session.py", line 355, in streams return plugin.streams(params) File "/usr/local/lib/python3.5/dist-packages/livestreamer/plugin/plugin.py", line 227, in streams ostreams = self._get_streams() File "/usr/local/lib/python3.5/dist-packages/livestreamer/plugins/stream.py", line 75, in _get_streams raise PluginError(err) livestreamer.exceptions.PluginError: Unable to open URL: http playlist.m3u8?referer=&timestamp=numbersxxxx (403 Client Error: Forbidden for url: http playlist.m3u8) 3 model(s) are being recorded. Checking for models to record (page 29) the following models are being recorded: xxxxx**

Other models seems to still be recording at the sametime of theses errors.

Also using Ubuntu x64 if any help....Not put this yet on my arch system yet.

beaston02 commented 6 years ago

The 403 error (403 Client Error: Forbidden for url: http playlist.m3u8) indicates the URL does exist, but it takes special credentials to access it. This is often passed in a url with a specific string in it. I was looking into cam4 yesterday a little while I was fixing the script, and I was specifically looking at the private streams seeing if there was an easy way to grab them through some URL manipulation or "guessing" where the stream was going to be coming from. They do have a string included that is specific to the user/guest who is viewing it. The stream doesnt actually change locations (url) when they go private, they just limit which users can access it, ie: since you didnt take them private, your unique string will be denied access (403 error).

Im assuming this is whats going on, but if you catch it again, maybe you could confirm. I imagine when the online check was done, the model was in a public show, then went private before the stream started downloading. This error did not stop the script from running, did it? It only logged that output to the terminal and continued running?

also, I sent you an email, which i mistakingly put "SMRecorder" in the subject line haha

francisuk1989 commented 6 years ago

sorry i didnt get your email

beaston02 commented 6 years ago

I just checked, and I had a typo.. I sent it to "gnail" not gmail. oops!

beaston02 commented 6 years ago

I just posted another update. Let me know if it works better. It will gather all of the online users, then remove any duplicates form that list (in case a model was found on multiple pages), then that list will be filtered for duplicates, and compared to the wanted list less the models who are already recording.

Let me know if that works better!

francisuk1989 commented 6 years ago

i have been running this for a week, It still showing some duplicated however is not to bad is maybe a case of going public and then info private....If you happy to close this @beaston02 then thats fine with me 👍 thanks for your help in resloving the issue.