-
Notifications
You must be signed in to change notification settings - Fork 5
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
ZIP file as directory support #3
Comments
+1 |
ATM I did workaround, but It's not satisfying ;/ #!/bin/bash
shopt -s nullglob
ID="$1"
DIR="$2"
TGDIR="$DIR/tg"
ZIPDIR="$DIR/zips"
mount_zip(){
zip="$1"
zipd="$ZIPDIR/$(basename "$zip")"
mkdir -p "$zipd"
echo Mounting $zip
archivemount -o readonly "$zip" "$zipd"
echo Mounted $zip
}
mount_zips(){
for zip in $TGDIR/*.zip; do
mount_zip "$zip" &
done
}
cleanup(){
for dir in $ZIPDIR/*; do
umount "$dir"
rmdir "$dir"
done
}
trap cleanup EXIT
mkdir -p "$TGDIR"
./tgmount.py --all-files --reverse --id $ID --mount "$TGDIR" |&
while read line; do
echo tgmount: $line
if [[ "$line" =~ "Mounting " ]]; then
sleep 1
echo Mounted telegram, starting mounting zips.
mount_zips &
fi
if [[ "$line" =~ "New file: " ]]; then
mid="$(awk 'match($0, /message_id'\'': [0-9]+?,/) { print substr($0, RSTART + 13, RLENGTH - 14) }' <<< $line)"
fname="$(echo $TGDIR/$mid\ *)"
echo New file: $fname
[[ "$fname" = *.zip ]] && mount_zip "$fname"
fi
done |
You forgot to mention that https://github.com/cybernoid/archivemount is used to mount the zip files |
I found project better fitting use case: https://github.com/openscopeproject/ZipROFS |
I'm currently working on the the feature :) thank you for the link. It is going to be useful to me |
@nktknshn any updates? I see only master branch |
I added this feature in the new version of tgmount. Try it out |
Me and my friends are sharing music with each other, but when we share albums - those are ZIPed.
What if your filesystem could mount those ZIP files as directories in filesystem?
There's very easy to use Zipfile lib in python stdlib.
The text was updated successfully, but these errors were encountered: