Giter Site home page Giter Site logo

ZIP file as directory support about tgmount HOT 7 OPEN

JuniorJPDJ avatar JuniorJPDJ commented on May 28, 2024 1
ZIP file as directory support

from tgmount.

Comments (7)

wvffle avatar wvffle commented on May 28, 2024

+1

from tgmount.

JuniorJPDJ avatar JuniorJPDJ commented on May 28, 2024

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

from tgmount.

wvffle avatar wvffle commented on May 28, 2024

You forgot to mention that https://github.com/cybernoid/archivemount is used to mount the zip files

from tgmount.

JuniorJPDJ avatar JuniorJPDJ commented on May 28, 2024

I found project better fitting use case: https://github.com/openscopeproject/ZipROFS
If you'd like to integrate this feature in tgmount - it seems to be pretty good base for your work.
If not, I'll just use this as next layer ;)

from tgmount.

nktknshn avatar nktknshn commented on May 28, 2024

I'm currently working on the the feature :) thank you for the link. It is going to be useful to me

from tgmount.

mockuser404 avatar mockuser404 commented on May 28, 2024

@nktknshn any updates? I see only master branch

from tgmount.

nktknshn avatar nktknshn commented on May 28, 2024

I added this feature in the new version of tgmount. Try it out
https://github.com/nktknshn/tgmount-ng

from tgmount.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.