File size: 2,812 Bytes
29af131
 
7a811c7
 
 
 
 
29af131
3b90d58
 
4e350f0
b13bd79
2a239be
a840b9b
3b90d58
 
bd65db9
5e96886
3b90d58
19c34a9
53f25bc
bd65db9
53f25bc
19c34a9
bd65db9
3b90d58
43ebf9d
9784d97
3b90d58
 
43ebf9d
9784d97
3b90d58
9784d97
 
 
abbd2d3
bd65db9
 
172a65f
e8a9e3f
abbd2d3
 
e8a9e3f
 
abbd2d3
 
c58797e
abbd2d3
b7a617c
5e96886
bd65db9
 
1dbb152
 
 
20b3117
1dbb152
b7a617c
5e96886
a840b9b
bd65db9
5e96886
 
 
20b3117
 
bd65db9
 
5e96886
a840b9b
 
 
 
 
 
 
 
 
 
 
 
78491c4
a840b9b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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)