UrloMythus commited on
Commit
74ee077
·
1 Parent(s): a7ebb6c
Files changed (4) hide show
  1. config.json +6 -5
  2. config.py +1 -0
  3. info.py +8 -3
  4. streamingcommunity.py +25 -11
config.json CHANGED
@@ -2,13 +2,14 @@
2
  "Siti": {
3
  "StreamingCommunity": {
4
  "enabled": "1",
5
- "domain": "boston"
 
6
  },
7
  "Filmpertutti": {
8
  "enabled": "0",
9
- "domain": "casino"
10
  },
11
- "Tuttifilm":{
12
  "enabled": "1",
13
  "domain": "bond",
14
  "fast_search": "0"
@@ -16,8 +17,8 @@
16
  },
17
  "General":{
18
  "load_env": "0",
19
- "HOST":"0.0.0.0",
20
  "PORT": "8080"
21
  }
22
  }
23
-
 
2
  "Siti": {
3
  "StreamingCommunity": {
4
  "enabled": "1",
5
+ "domain": "boston",
6
+ "fast_search": "0"
7
  },
8
  "Filmpertutti": {
9
  "enabled": "0",
10
+ "domain": "makeup"
11
  },
12
+ "Tantifilm":{
13
  "enabled": "1",
14
  "domain": "bond",
15
  "fast_search": "0"
 
17
  },
18
  "General":{
19
  "load_env": "0",
20
+ "HOST": "0.0.0.0",
21
  "PORT": "8080"
22
  }
23
  }
24
+
config.py CHANGED
@@ -13,6 +13,7 @@ SC_DOMAIN = SITE["StreamingCommunity"]['domain']
13
  TF_DOMAIN = SITE["Filmpertutti"]['enabled']
14
  FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
15
  STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
 
16
  #General
17
  GENERAL = config['General']
18
  dotenv = GENERAL["load_env"]
 
13
  TF_DOMAIN = SITE["Filmpertutti"]['enabled']
14
  FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
15
  STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
16
+ SC_FAST_SEARCH = SITE["StreamingCommunity"]['fast_search']
17
  #General
18
  GENERAL = config['General']
19
  dotenv = GENERAL["load_env"]
info.py CHANGED
@@ -2,6 +2,8 @@ from loadenv import load_env
2
  from tmdbv3api import TMDb, Movie, TV
3
  from convert_date import convert_US_date, convert_IT_date
4
  import requests
 
 
5
  TMDB_KEY= load_env()
6
 
7
  def get_info_tmdb(tmbda,ismovie,type):
@@ -14,9 +16,13 @@ def get_info_tmdb(tmbda,ismovie,type):
14
  showname = show.name
15
  if type == "Filmpertutti":
16
  date= show.first_air_date
17
- elif type == "StreamingCommunity":
18
- date = show.last_air_date
19
  print("Real date",date)
 
 
 
 
 
 
20
  else:
21
  movie = Movie()
22
  show= movie.details(tmbda)
@@ -55,7 +61,6 @@ def get_info_imdb(imdb_id, ismovie, type):
55
 
56
 
57
 
58
-
59
  def is_movie(imdb_id):
60
  if "tmdb:" in imdb_id:
61
  imdb_id = imdb_id.replace("tmdb:","")
 
2
  from tmdbv3api import TMDb, Movie, TV
3
  from convert_date import convert_US_date, convert_IT_date
4
  import requests
5
+ import config
6
+ SC_FAST_SEARCH = config.SC_FAST_SEARCH
7
  TMDB_KEY= load_env()
8
 
9
  def get_info_tmdb(tmbda,ismovie,type):
 
16
  showname = show.name
17
  if type == "Filmpertutti":
18
  date= show.first_air_date
 
 
19
  print("Real date",date)
20
+ return showname,date
21
+ elif type == "StreamingCommunity":
22
+ if SC_FAST_SEARCH == "0":
23
+ n_season = show.number_of_seasons
24
+ return showname,n_season
25
+
26
  else:
27
  movie = Movie()
28
  show= movie.details(tmbda)
 
61
 
62
 
63
 
 
64
  def is_movie(imdb_id):
65
  if "tmdb:" in imdb_id:
66
  imdb_id = imdb_id.replace("tmdb:","")
streamingcommunity.py CHANGED
@@ -10,6 +10,7 @@ import config
10
  import json
11
  #Get domain
12
  SC_DOMAIN= config.SC_DOMAIN
 
13
 
14
  headers = {
15
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
@@ -35,13 +36,18 @@ def get_version():
35
  version = "65e52dcf34d64173542cd2dc6b8bb75b"
36
  return version
37
 
38
- def search(query):
39
  #Do a request to get the ID of serie/move and it's slug in the URL
40
  response = requests.get(query).json()
41
  for item in response['data']:
42
  tid = item['id']
43
  slug = item['slug']
44
- return tid,slug
 
 
 
 
 
45
 
46
 
47
  def get_film(tid):
@@ -95,20 +101,28 @@ def streaming_community(imdb):
95
  general = is_movie(imdb)
96
  ismovie = general[0]
97
  imdb_id = general[1]
 
98
  if ismovie == 0 :
99
  season = int(general[2])
100
  episode = int(general[3])
101
- if "tt" in imdb:
102
- #Get showname
103
- showname = get_info_imdb(imdb_id,ismovie,"StreamingCommunity")
104
- else:
105
- #else just equals them
106
- tmdba = imdb_id.replace("tmdb:","")
107
- type = "StreamingCommunity"
108
- showname = get_info_tmdb(tmdba,ismovie,type)
 
 
 
 
 
 
 
109
  showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
110
  query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
111
- tid,slug = search(query)
112
  if ismovie == 1:
113
  #TID means temporaly ID
114
  url = get_film(tid)
 
10
  import json
11
  #Get domain
12
  SC_DOMAIN= config.SC_DOMAIN
13
+ SC_FAST_SEARCH = config.SC_FAST_SEARCH
14
 
15
  headers = {
16
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
 
36
  version = "65e52dcf34d64173542cd2dc6b8bb75b"
37
  return version
38
 
39
+ def search(query,n_season):
40
  #Do a request to get the ID of serie/move and it's slug in the URL
41
  response = requests.get(query).json()
42
  for item in response['data']:
43
  tid = item['id']
44
  slug = item['slug']
45
+ number_of_seasons = item['seasons_count']
46
+ if SC_FAST_SEARCH == "0":
47
+ if number_of_seasons == n_season:
48
+ return tid,slug
49
+ elif SC_FAST_SEARCH == "1":
50
+ return tid,slug
51
 
52
 
53
  def get_film(tid):
 
101
  general = is_movie(imdb)
102
  ismovie = general[0]
103
  imdb_id = general[1]
104
+ type = "StreamingCommunity"
105
  if ismovie == 0 :
106
  season = int(general[2])
107
  episode = int(general[3])
108
+ #Check if fast search is enabled or disabled
109
+ if SC_FAST_SEARCH == "1":
110
+ if "tt" in imdb:
111
+ #Get showname
112
+ showname = get_info_imdb(imdb_id,ismovie,type)
113
+ n_season = None
114
+ else:
115
+ #I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
116
+ n_season = None
117
+ #else just equals them
118
+ tmdba = imdb_id.replace("tmdb:","")
119
+ showname = get_info_tmdb(tmdba,ismovie,type)
120
+ elif SC_FAST_SEARCH == "0":
121
+ tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
122
+ showname,n_season = get_info_tmdb(tmdba,ismovie,type)
123
  showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
124
  query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
125
+ tid,slug = search(query,n_season)
126
  if ismovie == 1:
127
  #TID means temporaly ID
128
  url = get_film(tid)