import os # os.system('pip install jedi') # os.system('python -m pip install --upgrade pip setuptools wheel') # os.system('python -m pip install lbry-libtorrent') # os.system('apt-get install ffmpeg -y') # os.system('apt install python3-libtorrent') import streamlit as st from streamlit_option_menu import option_menu from others import * from torrents import * option = ['Magnet Link', 'Index Torrent', 'Link Redirect', 'Kode', 'Hitung Karakter/Kata'] # Navigasi Sidebar with st.sidebar: selected = option_menu("Torrent", option, icons=['search', 'house', 'fire', 'water'], menu_icon="cast", default_index=0) st.sidebar.image('DanMachi.png') if selected == option[0]: url = 'DanMachi.png' st.image(url) st.title(selected) link = st.text_input("Masukkan Magnet Link", "") search = link = st.text_input("Masukkan Pencarian", "") extension = st.selectbox('Pilih Extension', ['.mp4', '.zip']) if st.button("Trace On"): info = torrent_info(link, search, extension) file_priority = st.selectbox('Pilih File', info) if st.button("Download"): selected_index = int(file_priority.split('.')[0]) downloaded_files = torrent_download(link, [selected_index]) elif selected == option[1]: st.title(selected) teks = st.text_area("Masukkan Teks", '', height=(25 * 10)) tim = st.checkbox("Gak Perlu Dikelompokkan") if tim: group = 1000 else: group = st.slider("Pilih Jumlah Group", min_value=1, max_value=25, value=5) if st.button("Trace On"): info = torrent_group(int(group), teks) lokasi_file = simpan_txt('Group Torrent', info) sesi(info, lokasi_file) elif selected == option[2]: st.title(selected) link = st.text_input("Masukkan Link", "https://t.co/c31TBe7s4W") if st.button("Trace On"): info, url = link_redirect(link) lokasi_file = simpan_txt('Group Torrent', info) sesi(info, lokasi_file) elif selected == option[3]: st.title(selected) link = st.text_input("Masukkan Link", "https://t.co/8Qes0WO3GV") if st.button("Trace On"): info, url = link_redirect(link) info = format_info(url) lokasi_file = simpan_txt('Group Torrent', info) sesi(info, lokasi_file) else: st.title(selected) text = st.text_area("Masukkan Teks", '', height=(25 * 10)) choice = st.radio('Pilih Hitung:', ["Hitung Karakter", "Hitung Kata"], 0) if st.button("Trace On"): if choice == "Hitung Karakter": count = len(text) else: count = len(text.split()) info = f"Jumlah {choice.split(' ')[1]} dalam teks: " + str(count) lokasi_file = simpan_txt('Group Torrent', info) sesi(info, lokasi_file)