metube icon indicating copy to clipboard operation
metube copied to clipboard

Unable to delete downloaded videos

Open CodeWithCJ opened this issue 1 year ago • 16 comments

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 avatar Feb 23 '24 03:02 CodeWithCJ

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.

CodeWithCJ avatar Feb 23 '24 03:02 CodeWithCJ

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.

PikuZheng avatar Feb 23 '24 07:02 PikuZheng

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 avatar Feb 23 '24 16:02 CodeWithCJ

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 avatar Feb 23 '24 16:02 CodeWithCJ

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

CodeWithCJ avatar Feb 23 '24 16:02 CodeWithCJ

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

PikuZheng avatar Feb 23 '24 23:02 PikuZheng

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'

CodeWithCJ avatar Feb 24 '24 00:02 CodeWithCJ

try to add env

UID=1000
GID=1000

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

PikuZheng avatar Feb 24 '24 00:02 PikuZheng

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.

CodeWithCJ avatar Feb 24 '24 00:02 CodeWithCJ

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"}]

Astroamadeus avatar Feb 24 '24 06:02 Astroamadeus

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

CodeWithCJ avatar Feb 24 '24 19:02 CodeWithCJ

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...

Astroamadeus avatar Feb 24 '24 22:02 Astroamadeus

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

CodeWithCJ avatar Feb 24 '24 23:02 CodeWithCJ

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.

fanyangto avatar Mar 12 '24 19:03 fanyangto

Did you ever end up finding a fix to this? I am running into the same issue.

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.

LiamColeman avatar Jul 22 '24 15:07 LiamColeman

Did you ever end up finding a fix to this? I am running into the same issue.

I don't remember the exact command. Below are the steps I did

  • I asked chatgpt to list the folder directories and its access.
  • added my current user to the list of users access while keeping the previous user as well.

Then I was able to delete manually from Ubuntu. But Metube still didn't work.

CodeWithCJ avatar Jul 23 '24 04:07 CodeWithCJ