Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения
os.getenv(NAME)
И её "сестра" для создания или изменения переменных окружения
os.putenv(NAME, VALUE)
Но почему-то putenv() не работает как должно. Энвайромент не обновляется!
os.putenv('MYVAR', '1')
print(os.getenv('MYVAR'))
... и ничего 😴
Почему так?
На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ.
Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get()
В то время как putenv() это built-in С-функция.
Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет.
В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__().
То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так:
>>> os.putenv('MYVAR', '123')
>>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"')
123
Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ.
Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы.
Итого
▫️ Удобней всего явно обновлять переменные через os.environ
▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать!
▫️os.environ это просто обертка для built-in функций putenv() и unsetenv().
#basic
Morphe
https://morphe.software
https://github.com/MorpheApp
Morphe is an Android app modification tool.
It allows you to change how apps work, look, and behave beyond their original design.
Build new functionality, remove limitations, and tailor apps to your needs.
For now it supports these censored apps: YouTube, YouTube Music or Reddit.
You should boycott them, but if you are used by those propaganda apps, at least you could remove the unwanted ads
Morphe is an independent project based on prior work from ReVanced.
#yt
⚡️You-Get: Download video, audio, images from the web easily!
Ever wanted to pull a bunch of content down so you can watch later?
You-Get is a CLI (command line interface) utility that makes it easy to download videos, audio, and images from the web.
https://you-get.org
you-get 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
You Get supports an impressive array of sites: Youtube, Twitter, VK, Tumblr, Soundcloud, Instagram, Facebook, and countless others!
It supports downloading YouTube playlists as well, it'll go through each video in the playlist.
Downloads can be very slow though, I recommend you use the —info flag before downloading to see what formats are available. Then you can run the command again with the —i-tag flag at whichever quality level is right for you.
You can download videos off of big tech platforms / paywalls by using the '—cookies' flag and pointing to a Firefox cookies database (cookies.sqlite).
Alternative: https://ytdl-org.github.io/youtube-dl/
🫶@takebackourtech
#yt
#NewPipe on #Linux, Using Android_translation_layer
https://flathub.org/apps/net.newpipe.NewPipe
Comments
https://news.ycombinator.com/item?id=41963932
#yt
yt-fts - YouTube Full Text Search
https://github.com/NotJoeMartinez/yt-fts
yt-fts is a command line program that uses yt-dlp to scrape all of a #YouTube channels #subtitles and load them into a sqlite database that is searchable from the command line. It allows you to query a channel for specific key word or phrase and will generate time stamped YouTube urls to the video containing the keyword.
It also supports semantic search via the OpenAI embeddings API, Gemini embedding API and using chromadb.
Blog Post
LLM/RAG Chat Bot
Video Summaries
Semantic Search
CHANGELOG
Installation:
pip install yt-fts
#yt
SmartTube
Advanced player for set-top boxes and tvs running Android OS
Features
No Ads
Designed for TV screens
Up to 8K video resolution
Login into your account
Cast from the phone
Support tv box remote controller
Support external software keyboard
Support devices without Google Services
Open source
https://smarttubeapp.github.io
https://github.com/yuliskov/SmartTube
https://github.com/yuliskov/SmartTube/releases
WARNING NOT FULLY OPEN SOURCE
There are at least 5 proprietary libraries in the app.
https://github.com/yuliskov/SmartTube/issues/471
* Crashlytics (/com/crashlytics): Tracking
* Firebase Data Transport (/com/google/android/datatransport): NonFreeNet
* Google Mobile Services (/com/google/android/gms): NonFreeDep
* Firebase (/com/google/firebase): NonFreeNet,NonFreeDep
* Firebase Analytics (/com/google/firebase/analytics): Tracking
IzzySoft:
The 5 offenders are not permitted at F-Droid (and before you ask: I wouldn't take it into my repo either unless at least Crashlytics and Firebase Analytics are removed; 5 non-free libraries is a bit much for free/libre software).
#video#yt#androidtv
Latest release Freetube - An electron Youtube client that blocks ads (but can't avoid Google's YouTube censorship) now comes with support for sponsorblock
https://github.com/FreeTubeApp/FreeTube/releases/tag/v0.13.0-beta
#freetube#yt#YouTube