-
Notifications
You must be signed in to change notification settings - Fork 53
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
I want to change the saved address. #140
Comments
I'm not quite sure if I understand the question correctly. The download directory can be changed via the parameters.py. The code uses os.path so when setting the path you have to consider that you either have to escape or pass a raw string. For example, to set C:\Downloads\StreaMonitor as the folder, the following variants are possible: DOWNLOADS_DIR = 'C:\\Downloads\\StreaMonitor' or as Raw-String: DOWNLOADS_DIR = r'C:\Downloads\StreaMonitor' It is possible that problems may arise from the fact that os.path.join is used. I don't have Windows to test at the moment. |
Ok, I'll test it tomorrow, you've understood half of it, I'd like to change the save directory, hopefully so it won't be a case of each author having a separate folder. |
To prevent this, the code would have to be changed. Bot.py from line 265: @property
def outputFolder(self):
return os.path.join(DOWNLOADS_DIR, self.username + ' [' + self.siteslug + ']')
def genOutFilename(self, create_dir=True):
folder = self.outputFolder
if create_dir:
os.makedirs(folder, exist_ok=True)
now = datetime.now()
filename = os.path.join(folder, self.username + '-' + str(now.strftime("%Y%m%d-%H%M%S")) + '.mp4')
return filename As you can see, the path is built statically. This should be prevented. To do this, you would simply have to adjust outputFolder and throw out the creation of the folder in genOutFilename. |
thanks |
Could look like this: @property
def outputFolder(self):
return DOWNLOADS_DIR
def genOutFilename(self, create_dir=False):
folder = self.outputFolder
if create_dir:
os.makedirs(folder, exist_ok=True)
now = datetime.now()
filename = os.path.join(folder, self.username + '-' + str(now.strftime("%Y%m%d-%H%M%S")) + '.mp4')
return filename Make sure the directory you specify in parameters.py exists. All files should go as files into that directory with this snippet (not tested). |
This one's right, too.One other change I'd like to make, I'd like to split the videos and limit each video to 2G. |
You could try -fs 2G. However, you will have to change the code again. This should stop ffmpeg when 2GB is reached. This should result in a short loss but the bot should continue to work. The ffmpeg.py would have to be changed like this: def getVideoFfmpeg(self, url, filename):
cmd = [
'ffmpeg',
'-user_agent', self.headers['User-Agent']
]
if type(self.cookies) is requests.cookies.RequestsCookieJar:
cookies_text = ''
for cookie in self.cookies:
cookies_text += cookie.name + "=" + cookie.value + "; path=" + cookie.path + '; domain=' + cookie.domain + '\n'
if len(cookies_text) > 10:
cookies_text = cookies_text[:-1]
cmd.extend([
'-cookies', cookies_text
])
cmd.extend([
'-i', url,
'-c:a', 'copy',
'-c:v', 'copy',
'-fs', '2G', # Addition inserted here
filename
]) Not tested could lead to problems. |
Ok, I just updated these codes and it works. |
I have no idea what the Live Scan Uplaoder is. In general: A tool that only uploads files from the folder - i.e. only reads data - should not cause any problems. However, the data can of course be corrupted at the destination as long as the script does not ensure that the file is not still open and is therefore being processed. Tools that perform other operations should also ensure that the file they are processing is no longer open. |
DEBUG must be set to True in the parameters.py file. Logs of the ffmpeg output should then be created. Otherwise you can only check whether the CLI produces exceptions or other errors occur. |
OK,Is it possible to move the video to the folder I want after recording? That way there is no conflict. |
Not at the moment. It would certainly be possible to incorporate this. But that would be a little more complex. |
Looking forward to it, this could be an awesome feature! |
See this Not tested use at own risk. |
ok,I downloaded it.What variables do I need to change? |
parameters.py now knows the variable MOVE_DIR This is the target folder. If everything works, the file should be moved to this folder when ffmpeg ends. Before that it is in the folder that is set in DOWNLOADS_DIR. MOVE_DIR should be created if it does not exist the first time. I have included the previous changes. Example: If C:\Downloads is the DOWNLOADS_DIR and C:\completed\ is the MOVE_DIR, C:\Downloads\foo should be moved to C:\completed\foo after ffmpeg has finished. |
This needs at least Python 3.4 I recommand using 3.11.5 in general for StreaMonitor. Edit: Only FFmpeg Downloader is patched. There is actually no general Downloader Interface or Super Class. |
I've been using 3.11.5 and this design is fantastic, I'm not very good at python, thanks a lot!I'll run the test right away. |
DOWNLOADS_DIR = 'downloads' folder |
In this case yes. Because of the situation that you have a new setup I guess. Because we set False at the genOutFilename function for create_folder before. This is included in the my patched branch. Edit: Patched this in my branch. So the folder now gets created if it don't exists. Could be cleaner but it's just the function as it was before. |
There seems to be a bug. I'll show you a screenshot.
2024-04-01 17:16:29,900 - INFO - manager_cli: Unknown command
|
Fixed in my branch. My mistake. It's .joinpath() not .join(). |
ok,i downloader |
Are the directories on the same drive? Path.rename() is restricted to the same windows drive. If this should work over multiple drives we would need to try shutil. And eventally again check the code. |
Yes, it's on the same hard drive, but no moving video |
Also in sense of Windows Drive? So it's nos something like C: and D:? Another problem could be the system locale hm...... |
No, it's the same hard drive. |
Ok. I will need to test this. The issue will be solveable. It just need to be checked how it's done best. Writing code that runs on a completely different OS is always a bit problematic |
OK |
How would i go about changing path on Linux. I've tried:
All of them still outputs to the download folder |
First things like ~, .. and . confuse os.mkdir and os.mkdirs. DOWNLOADS_DIR = '/my/path/to/dl/dir/' Should work fine. Make sure totally stop the Downlaoder and start it again. |
I want to change the save location on Windows, or move all recorded videos to a folder, can I do that without setting up folders for each ID?
What files do I need to configure to modify them?
The text was updated successfully, but these errors were encountered: