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

Delete media from mentions #44

Open
lapineige opened this issue Jun 26, 2019 · 6 comments
Open

Delete media from mentions #44

lapineige opened this issue Jun 26, 2019 · 6 comments

Comments

@lapineige
Copy link

I downloaded my archive with my toots + mentions.
Then I downloaded the media.
The issue is that the media archive contains the media from the mentions.
I would like to get rid of them.

Is it possible to add an option to download/remove the media from the mentions ?

@kensanata
Copy link
Owner

Not with the tool itself, unfortunately.

@kensanata
Copy link
Owner

I'd say such a feature would have to be added to the file media.py, in other words, some option for the media command.

@lapineige
Copy link
Author

Ok, so as well as #40 that's something I should try to add, I guess ? :)

@kensanata
Copy link
Owner

kensanata commented Jun 30, 2019

Maybe? 😄

Actually, if you're comfortable with the command line, you could get the URLs of the url and the preview_url attributes of all the media in mentions (I think! Lightly tested…) by using this jq command:

jq '.mentions[].media_attachments[]|.url,.preview_url' octodon.social.user.kensanata.json

With a little sed you can extract all the path's you need:

jq '.mentions[].media_attachments[]|.url,.preview_url' octodon.social.user.kensanata.json \
| sed -n -e 's/[^\/]*\/\/[^\/]*\/\([^"]*\)"$/\1/p'

So perhaps this is enough to wrap around a loop to rm? Something like the following, untested?

rm $(jq '.mentions[].media_attachments[]|.url,.preview_url' octodon.social.user.kensanata.json \
| sed -n -e 's/[^\/]*\/\/[^\/]*\/\([^"]*\)"$/\1/p')

@lapineige
Copy link
Author

Well, it's not that I don't want to do it, but I don't have the time right know but those media files takes some storage space 😅

So thanks a lot for your command, I'll investigate.
And maybe add some PR :)

(the best would be not to download them, with an option)

@kensanata
Copy link
Owner

Yeah, to be honest I never download media...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants