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

Unable to delete downloaded videos #399

Open
CodeWithCJ opened this issue Feb 23, 2024 · 14 comments
Open

Unable to delete downloaded videos #399

CodeWithCJ opened this issue Feb 23, 2024 · 14 comments

Comments

@CodeWithCJ
Copy link

Unable to delete downloaded videos. Though they are deleted in the web, its not getting deleted in the server actual folder. So when i try to download another file from instagram, it tries to create video file with same generic name and it doesn't save it.
So i have to go to the folder in ubuntu and manually delete and then only new video can be downloaded.
I also noticed folder permission is changed after the docker compose file is run. This causes I have to use SUDO command to delete. Maybe the web is not running with required permission that is the reason its not downloading/deleting the videos properly in the physical location where the volume is mapped.

@CodeWithCJ
Copy link
Author

I also noticed, if I add suffic this causes the video to be downloaded with new name. In that case its able to save the file. But when it tries to download two different videos, it always takes same name but unable to save due to folder permission issues. I deleted the containers and redeployed and it is still the same.

@PikuZheng
Copy link
Contributor

Yes in the new version of metube it seems to be trying to modify the permissions of every file in the downloads folder. I don't understand why this is done, even though it has no effect on me.

@CodeWithCJ
Copy link
Author

Here is the example where it retained old video though I delete from front web.

image

Here is the screen where i can't delete the files directly and had to use SUDO command to do. (I removed the file name and user name. so output might look weird but its because I didn't clean up file & username before posting here.)

user@ubuntu:/user/metube$ rm *.mp4
rm: remove write-protected regular file ' -11-02.mp4'? yes
rm: cannot remove '2023-11-02.mp4': Permission denied
rm: remove write-protected regular file 'r - 2024-02-15.mp4'? yes
rm: cannot remove 'star - 2024-02-15.mp4': Permission denied
user@ubuntu:/user/metube$ sudo rm .mp4
[sudo] password for user:
user@ubuntu:/user/metube$

@CodeWithCJ
Copy link
Author

Yes in the new version of metube it seems to be trying to modify the permissions of every file in the downloads folder. I don't understand why this is done, even though it has no effect on me.

Did you find out if you are deleting the file from the web, does it delete in the download folder as well? Since it couldn't delete from WEB, downloading new videos were not working as the instagram videos were all downloading with same name. I had to add suffic so that it is aved as different file name for it to download & save successfully. But even though I delete, it doesn't delete the files in the download folder/docker folder mapped in the volume.

Docker log also doesn't show any error about deletion or failure to delete due to any permission issues.

@CodeWithCJ
Copy link
Author

I also noticed the folder permissions are changed to some number. I don't know what this 100999 means. COuld it be dynamic docker user ID?

drwxr-xr-x 4 100999 100999 4096 Feb 23 11:04 /mypath/metube

@PikuZheng
Copy link
Contributor

Are the download floder and container on the same pc (ubuntu)?

@CodeWithCJ
Copy link
Author

CodeWithCJ commented Feb 24, 2024

Are the download floder and container on the same pc (ubuntu)?

yes. they are in same machine. I deleting the folder, removing the stack , image,volume and did multiple clean installs. its always the same.

Could you check if I need to add any folder permissions via env settings?

version: "3"
services:
metube:
image: ghcr.io/alexta69/metube
container_name: metube
restart: always
ports:
- "8081:8081"
volumes:
- /sparky/metube:/downloads
- /sparky/metube/cookies:/cookies
environment:
- YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt"}
- 'OUTPUT_TEMPLATE=%(playlist_title&Playlist |)S%(playlist_title|)S%(playlist_uploader& by |)S%(playlist_uploader|)S%(playlist_autonumber& - |)S%(playlist_autonumber|)S%(playlist_count& of |)S%(playlist_count|)S%(playlist_autonumber& - |)S%(uploader,creator|UNKNOWN_AUTHOR)S - %(title|UNKNOWN_TITLE)S - %(release_date>%Y-%m-%d,upload_date>%Y-%m-%d|UNKNOWN_DATE)S.%(ext)s'

@PikuZheng
Copy link
Contributor

try to add env

UID=1000
GID=1000

or the uid with the same of ubuntu user (user@ubuntu)

@CodeWithCJ
Copy link
Author

try to add env

UID=1000
GID=1000

or the uid with the same of ubuntu user (user@ubuntu)

unfortunately this didn't work. my user ID also had 1000. Thought the video file is deleted from the web, it is still there in the download folder.

@Astroamadeus
Copy link

Astroamadeus commented Feb 24, 2024

The workaround I use is this:

For folders permission: this inotify command:

WATCH_DIR=/dir1
SETTLE_DURATION=5
MAX_WAIT_TIME=05:00
MIN_PERIOD=00:01
COMMAND="find ${WATCH_DIR} -type d -print0 |xargs -0 chmod -c 777"
USER_ID=0
GROUP_ID=0
UMASK=0000
IGNORE_EVENTS_WHILE_COMMAND_IS_RUNNING=1
USE_POLLING=no
DEBUG=0

For files permissions, they can be set within the metube container itself, by adding the following to its options:

"postprocessors": [{"key": "Exec", "exec_cmd": "chmod 0666", "when": "after_move"}]

@CodeWithCJ
Copy link
Author

The workaround I use is this:

For folders permission: this inotify command:

WATCH_DIR=/dir1 SETTLE_DURATION=5 MAX_WAIT_TIME=05:00 MIN_PERIOD=00:01 COMMAND="find ${WATCH_DIR} -type d -print0 |xargs -0 chmod -c 777" USER_ID=0 GROUP_ID=0 UMASK=0000 IGNORE_EVENTS_WHILE_COMMAND_IS_RUNNING=1 USE_POLLING=no DEBUG=0

For files permissions, they can be set within the metube container itself, by adding the following to its options:

"postprocessors": [{"key": "Exec", "exec_cmd": "chmod 0666", "when": "after_move"}]

Is this correct? Still the same problem. Deploying the container changes the permission. I couldn't modify anything in the download folder.
And also deleting the video from web doesn't delete the video in the download folder.

version: "3" services: metube: image: ghcr.io/alexta69/metube container_name: metube restart: always ports: - "8081:8081" volumes: - /sparky/metube:/downloads - /sparky/metube/cookies:/cookies environment: - 'YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt", "postprocessors": [{"key": "Exec", "exec_cmd": "chmod 0666", "when": "after_move"}]}' - 'OUTPUT_TEMPLATE=%(playlist_title&Playlist |)S%(playlist_title|)S%(playlist_uploader& by |)S%(playlist_uploader|)S%(playlist_autonumber& - |)S%(playlist_autonumber|)S%(playlist_count& of |)S%(playlist_count|)S%(playlist_autonumber& - |)S%(uploader,creator|UNKNOWN_AUTHOR)S - %(title|UNKNOWN_TITLE)S - %(release_date>%Y-%m-%d,upload_date>%Y-%m-%d|UNKNOWN_DATE)S.%(ext)s' - USER_ID=0 - GROUP_ID=0 - UMASK=0000 - WATCH_DIR=/dir1 - SETTLE_DURATION=5 - MAX_WAIT_TIME=05:00 - MIN_PERIOD=00:01 - COMMAND="find ${WATCH_DIR} -type d -print0 | xargs -0 chmod -c 777" - IGNORE_EVENTS_WHILE_COMMAND_IS_RUNNING=1 - USE_POLLING=no - DEBUG=0

@Astroamadeus
Copy link

Astroamadeus commented Feb 24, 2024

The workaround I use is this:
For folders permission: this inotify command:
WATCH_DIR=/dir1 SETTLE_DURATION=5 MAX_WAIT_TIME=05:00 MIN_PERIOD=00:01 COMMAND="find ${WATCH_DIR} -type d -print0 |xargs -0 chmod -c 777" USER_ID=0 GROUP_ID=0 UMASK=0000 IGNORE_EVENTS_WHILE_COMMAND_IS_RUNNING=1 USE_POLLING=no DEBUG=0
For files permissions, they can be set within the metube container itself, by adding the following to its options:
"postprocessors": [{"key": "Exec", "exec_cmd": "chmod 0666", "when": "after_move"}]

Is this correct? Still the same problem. Deploying the container changes the permission. I couldn't modify anything in the download folder. And also deleting the video from web doesn't delete the video in the download folder.

version: "3" services: metube: image: ghcr.io/alexta69/metube container_name: metube restart: always ports: - "8081:8081" volumes: - /sparky/metube:/downloads - /sparky/metube/cookies:/cookies environment: - 'YTDL_OPTIONS={"cookiefile":"/cookies/cookies.txt", "postprocessors": [{"key": "Exec", "exec_cmd": "chmod 0666", "when": "after_move"}]}' - 'OUTPUT_TEMPLATE=%(playlist_title&Playlist |)S%(playlist_title|)S%(playlist_uploader& by |)S%(playlist_uploader|)S%(playlist_autonumber& - |)S%(playlist_autonumber|)S%(playlist_count& of |)S%(playlist_count|)S%(playlist_autonumber& - |)S%(uploader,creator|UNKNOWN_AUTHOR)S - %(title|UNKNOWN_TITLE)S - %(release_date>%Y-%m-%d,upload_date>%Y-%m-%d|UNKNOWN_DATE)S.%(ext)s' - USER_ID=0 - GROUP_ID=0 - UMASK=0000 - WATCH_DIR=/dir1 - SETTLE_DURATION=5 - MAX_WAIT_TIME=05:00 - MIN_PERIOD=00:01 - COMMAND="find ${WATCH_DIR} -type d -print0 | xargs -0 chmod -c 777" - IGNORE_EVENTS_WHILE_COMMAND_IS_RUNNING=1 - USE_POLLING=no - DEBUG=0

For the folders permission, i provided a INOTIFY command (see https://man7.org/linux/man-pages/man7/inotify.7.html). You cannot use it in the metube docker container. I am using this docker container for it: https://github.com/coppit/docker-inotify-command. As I said, it is a workaround...

@CodeWithCJ
Copy link
Author

I manually added my username to the folder permission which helped with deletion of the file without sudo command. but still deletion from web doesn't delete the files in the actual download folder. I have to manually navigate via putty or login to ubuntu to delete them

@fanyangto
Copy link

try to add env

UID=1000
GID=1000

or the uid with the same of ubuntu user (user@ubuntu)

I don't think this is the reason. I have added -e UID=ubuntu -e GID=ubuntu, these are the 1000:1000 ID on my system, and also the account from which I did sudo docker run. But it doesn't solve the problem.

There is something broken, not a simple permission perhaps.

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

4 participants