Skip to content

Commit

Permalink
[plugin.video.3cat]v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mcr222 committed Oct 22, 2024
1 parent f29d954 commit a24d50e
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 246 deletions.
6 changes: 5 additions & 1 deletion plugin.video.3cat/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
v1.1.0
v1.2.0
- Added direct stream
- Fix naming

v1.1.0
-Play old mp4 format videos

v1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ msgid "Canal 324"
msgstr "Canal 324"

msgctxt "#30020"
msgid "Canal 33-Super 3"
msgstr "Canal 33-Super 3"
msgid "SX3"
msgstr "SX3"

msgctxt "#30021"
msgid "Esport 3"
Expand All @@ -117,8 +117,8 @@ msgid "Canal 324 (International broadcast)"
msgstr "Canal 324 (Emissió internacional)"

msgctxt "#30026"
msgid "Canal 33-Super 3 (International broadcast)"
msgstr "Canal 33-Super 3 (Emissió internacional)"
msgid "SX3 (International broadcast)"
msgstr "SX3 (Emissió internacional)"

msgctxt "#30027"
msgid "Esport 3 (International broadcast)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ msgid "Canal 324"
msgstr "Canal 324"

msgctxt "#30020"
msgid "Canal 33-Super 3"
msgstr "Canal 33-Super 3"
msgid "SX3"
msgstr "SX3"

msgctxt "#30021"
msgid "Esport 3"
Expand All @@ -117,8 +117,8 @@ msgid "Canal 324 (International broadcast)"
msgstr "Canal 324 (International)"

msgctxt "#30026"
msgid "Canal 33-Super 3 (International broadcast)"
msgstr "Canal 33-Super 3 (International)"
msgid "SX3 (International broadcast)"
msgstr "SX3 (International)"

msgctxt "#30027"
msgid "Esport 3 (International broadcast)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ msgid "Canal 324"
msgstr "Canal 324"

msgctxt "#30020"
msgid "Canal 33-Super 3"
msgstr "Canal 33-Super 3"
msgid "SX3"
msgstr "SX3"

msgctxt "#30021"
msgid "Esport 3"
Expand All @@ -117,8 +117,8 @@ msgid "Canal 324 (International broadcast)"
msgstr "Canal 324 (International broadcast)"

msgctxt "#30026"
msgid "Canal 33-Super 3 (International broadcast)"
msgstr "Canal 33-Super 3 (International broadcast)"
msgid "SX3 (International broadcast)"
msgstr "SX3 (International broadcast)"

msgctxt "#30027"
msgid "Esport 3 (International broadcast)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ msgid "Canal 324"
msgstr "Canal 324"

msgctxt "#30020"
msgid "Canal 33-Super 3"
msgstr "Canal 33-Super 3"
msgid "SX3"
msgstr "SX3"

msgctxt "#30021"
msgid "Esport 3"
Expand All @@ -117,8 +117,8 @@ msgid "Canal 324 (International broadcast)"
msgstr "Canal 324 (Emisión internacional)"

msgctxt "#30026"
msgid "Canal 33-Super 3 (International broadcast)"
msgstr "Canal 33-Super 3 (Emisión internacional)"
msgid "SX3 (International broadcast)"
msgstr "SX3 (Emisión internacional)"

msgctxt "#30027"
msgid "Esport 3 (International broadcast)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ msgid "Canal 324"
msgstr "Canal 324"

msgctxt "#30020"
msgid "Canal 33-Super 3"
msgstr "Canal 33-Super 3"
msgid "SX3"
msgstr "SX3"

msgctxt "#30021"
msgid "Esport 3"
Expand All @@ -117,8 +117,8 @@ msgid "Canal 324 (International broadcast)"
msgstr "Canal 324 (Utland)"

msgctxt "#30026"
msgid "Canal 33-Super 3 (International broadcast)"
msgstr "Canal 33-Super 3 (Utland)"
msgid "SX3 (International broadcast)"
msgstr "SX3 (Utland)"

msgctxt "#30027"
msgid "Esport 3 (International broadcast)"
Expand Down
4 changes: 2 additions & 2 deletions plugin.video.3cat/resources/lib/tv3cat/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def getList(strings):
#mesvist = FolderVideo(strings.get('mesvist'), url_mesvist, "mesvist", "", "")
coleccions = FolderVideo(strings.get('coleccions'), "", "coleccions", "", "")
#programes = FolderVideo(strings.get('programes'), "", "programes", "", "")
#directe = FolderVideo(strings.get('directe'), "", "directe", "", "")
directe = FolderVideo(strings.get('directe'), "", "directe", "", "")
#cercar = FolderVideo(strings.get('cercar'), "", "cercar", "", "")

return [coleccions]
return [coleccions, directe]
3 changes: 2 additions & 1 deletion plugin.video.3cat/resources/lib/tv3cat/Images.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ def __init__(self, addon_path):

self.thumb_tv3 = os.path.join(addon_path, 'resources', 'media', 'tv3_thumbnail.png')
self.thumb_324 = os.path.join(addon_path, 'resources', 'media', '324_thumbnail.png')
self.thumb_c33s3 = os.path.join(addon_path, 'resources', 'media', 'c33-super3_thumbnail.png')
self.thumb_c33 = os.path.join(addon_path, 'resources', 'media', 'c33_thumbnail.png')
self.thumb_sx3 = os.path.join(addon_path, 'resources', 'media', 'sx3_thumbnail.jpeg')
self.thumb_esp3 = os.path.join(addon_path, 'resources', 'media', 'esports3_thumbnail.png')
2 changes: 1 addition & 1 deletion plugin.video.3cat/resources/lib/tv3cat/TV3Strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, addon):
'directe': 30017,
'tv3': 30018,
'canal324': 30019,
'c33super3': 30020,
'sx3': 30020,
'esport3': 30021,
'cercar': 30022,
'coleccions': 30023,
Expand Down
178 changes: 9 additions & 169 deletions plugin.video.3cat/resources/lib/tv3cat/TV3cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,104 +112,16 @@ def dirSections(self):

# mode = directe
def listDirecte(self):
xbmc.log("-----------------listDirecte--------------------")
lVideos = []
xbmc.log("plugin.video.3cat listDirecte")

tv3Directe = Video(self.strs.get('tv3'), self.images.thumb_tv3, self.images.thumb_tv3, "TV3", Urls.url_directe_tv3, "")
c324Directe = Video(self.strs.get('canal324'), self.images.thumb_324, self.images.thumb_324, "324", Urls.url_directe_324, "")
sx3Directe = Video(self.strs.get('sx3'), self.images.thumb_sx3, self.images.thumb_sx3, "SX3", Urls.url_directe_sx3, "")
sps3Directe = Video(self.strs.get('esport3'), self.images.thumb_esp3, self.images.thumb_esp3, "E3", Urls.url_directe_esport3, "")
c33Directe = Video("C33", self.images.thumb_c33, self.images.thumb_c33, "E3", Urls.url_directe_c33, "")

return [tv3Directe, sx3Directe, c324Directe, sps3Directe, c33Directe]

data = getDataVideo(Urls.url_arafem)

if data:
c = data.get('canal', None)

if c:

arafemtv3 = ''
arafem33 = ''
arafemesp3 = ''
arafem324 = ''
arafemtv3_sinop = ''
arafem33_sinop = ''
arafemesp3_sinop = ''
arafem324_sinop = ''

i = 0
while i < 5:
nameChannel = c[i].get('ara_fem', {}).get('codi_canal', None)

if nameChannel == 'tv3':
arafemtv3 = c[i].get('ara_fem', {}).get('titol_programa', None)
arafemtv3_sinop = c[i].get('ara_fem', {}).get('sinopsi', None)
if nameChannel == 'cs3' or nameChannel == '33d':
arafem33 = c[i].get('ara_fem', {}).get('titol_programa', None)
arafem33_sinop = c[i].get('ara_fem', {}).get('sinopsi', None)
if nameChannel == 'esport3':
arafemesp3 = c[i].get('ara_fem', {}).get('titol_programa', None)
arafemesp3_sinop = c[i].get('ara_fem', {}).get('sinopsi', None)
if nameChannel == '324':
arafem324 = c[i].get('ara_fem', {}).get('titol_programa', None)
arafem324_sinop = c[i].get('ara_fem', {}).get('sinopsi', None)

i = i + 1

infolabelstv3 = {}
infolabels324 = {}
infolabels33 = {}
infolabelsesp3 = {}

if arafemtv3:
infolabelstv3['title'] = arafemtv3
infotv3 = '[B]' + arafemtv3 + '[/B]' + '[CR]'
if arafemtv3_sinop:
if type(arafemtv3) is int or type(arafemtv3) is float:
arafemtv3 = str(arafemtv3)
infotv3 = infotv3 + arafemtv3_sinop

infolabelstv3['plot'] = infotv3

if arafem33:
infolabels33['title'] = arafem33
info33 = '[B]' + arafem33 + '[/B]' + '[CR]'
if arafem33_sinop:
if type(arafem33) is int or type(arafem33) is float:
arafem33 = str(arafem33)
info33 = info33 + arafem33_sinop

infolabels33['plot'] = info33

if arafemesp3:
infolabelsesp3['title'] = arafemesp3
infoesp3 = '[B]' + arafemesp3 + '[/B]' + '[CR]'
if arafemesp3_sinop:
if type(arafemesp3) is int or type(arafemesp3) is float:
arafemesp3 = str(arafemesp3)
infoesp3 = infoesp3 + arafemesp3_sinop

infolabelsesp3['plot'] = infoesp3

if arafem324:
infolabels324['title'] = arafem324
info324 = '[B]' + arafem324 + '[/B]' + '[CR]'
if arafem324_sinop:
if type(arafem324) is int or type(arafem324) is float:
arafem324 = str(arafem324)
info324 = info324 + arafem324_sinop

infolabels324['plot'] = info324

tv3Directe = Video(self.strs.get('tv3'), self.images.thumb_tv3, self.images.thumb_tv3, infolabelstv3, Urls.url_directe_tv3, "")
c324Directe = Video(self.strs.get('canal324'), self.images.thumb_tv3, self.images.thumb_tv3, infolabels324, Urls.url_directe_324, "")
c33s3Directe = Video(self.strs.get('c33super3'), self.images.thumb_tv3, self.images.thumb_tv3, infolabels33, Urls.url_directe_c33s3, "")
sps3Directe = Video(self.strs.get('esport3'), self.images.thumb_tv3, self.images.thumb_tv3, infolabelsesp3, Urls.url_directe_esport3, "")

tv3DirecteInt = Video(self.strs.get('tv3_int'), self.images.thumb_tv3, self.images.thumb_tv3, infolabelstv3, Urls.url_directe_tv3_int, "")
c324DirecteInt = Video(self.strs.get('canal324_int'), self.images.thumb_tv3, self.images.thumb_tv3, infolabels324, Urls.url_directe_324_int, "")
c33s3DirecteInt = Video(self.strs.get('c33super3_int'), self.images.thumb_tv3, self.images.thumb_tv3, infolabels33, Urls.url_directe_c33s3_int, "")
sps3DirecteInt = Video(self.strs.get('esport3_int'), self.images.thumb_tv3, self.images.thumb_tv3, infolabelsesp3, Urls.url_directe_esport3_int, "")

lVideos = [tv3Directe, c33s3Directe, c324Directe, sps3Directe, tv3DirecteInt, c33s3DirecteInt, c324DirecteInt, sps3DirecteInt]

result = [None] * 2
result[0] = lVideos
return result

def getProgramaData(self, programaId):
apiUrl = ("https://api.3cat.cat/videos?version=2.0&_format=json&items_pagina=1000&capitol=1|&tipus_contingut=PPD&ordre=capitol&idioma=PU_CATALA&programatv_id={}&perfil=pc"
Expand Down Expand Up @@ -287,78 +199,6 @@ def getListVideos(self, url):

return lVideos


def getVideo(self, data):
linkvideo = None
media = data.get('media', {})

if type(media) is list and len(media) > 0:
media_dict = media[0]
linkvideo = media_dict.get('url', None)
else:
linkvideo = media.get('url', None)

if linkvideo != None:
if type(linkvideo) is list and len(linkvideo) > 0:
linkvideo_item = linkvideo[0]
urlVideo = linkvideo_item.get('file', None)

titol = data.get('informacio', {}).get('titol', None)
image = data.get('imatges', {}).get('url', None)
descripcio = data.get('informacio', {}).get('descripcio', None)
programa = data.get('informacio', {}).get('programa', None)
capitol = data.get('informacio', {}).get('capitol', None)
tematica = data.get('informacio', {}).get('tematica', {}).get('text', None)
data_emisio = data.get('informacio', {}).get('data_emissio', {}).get('text', None)
milisec = data.get('informacio', {}).get('durada', {}).get('milisegons', None)
durada = ""

if milisec != None:
durada = milisec // 1000


if descripcio == None:
descripcio = ''
else:
descripcio = descripcio.replace('<br />', '')

header = ""
if programa != None:
if type(programa) is int or type(programa) is float:
programa = str(programa)
header = '[B]' + programa + '[/B]' + '[CR]'

infolabels = {}
if data_emisio != None:
dt = data_emisio[0:10]
year = data_emisio[6:10]
infolabels['aired'] = dt
infolabels['year'] = year
header = header + dt + '[CR]'

descripcio = header + descripcio

if titol != None:
infolabels['title'] = titol


if capitol != None:
infolabels['episode'] = capitol


if descripcio != None:
infolabels['plot'] = descripcio

if tematica != None:
infolabels['genre'] = tematica

video = Video(titol, image, image, infolabels, urlVideo, durada )

return video

else:
return None

#mode = cercar
def search(self):

Expand Down
16 changes: 8 additions & 8 deletions plugin.video.3cat/resources/lib/tv3cat/TestHtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#videos = tv3.getListVideos("https://www.3cat.cat/3cat/bricoheroes/capitols/temporada/2/")
#print(len(videos))
#print(videos[0])
# videoId = 6176980
# apiJsonUrl = "https://api-media.3cat.cat/pvideo/media.jsp?media=video&versio=vast&idint={}&profile=pc_3cat&format=dm".format(
# videoId)
# print(apiJsonUrl)
# with urllib.request.urlopen(apiJsonUrl) as response:
# data = response.read()
# json_data = json.loads(data)
# print(json_data['media']['url'][0]['file'])
videoId = 6176980
apiJsonUrl = "https://api-media.3cat.cat/pvideo/media.jsp?media=video&versio=vast&idint={}&profile=pc_3cat&format=dm".format(
videoId)
print(apiJsonUrl)
with urllib.request.urlopen(apiJsonUrl) as response:
data = response.read()
json_data = json.loads(data)
print(json_data['media']['url'][0]['file'])
8 changes: 6 additions & 2 deletions plugin.video.3cat/resources/lib/ui/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import xbmcvfs
import urllib.parse

from resources.lib.video.Video import Video

PROTOCOL = 'mpd'
DRM = 'com.widevine.alpha'
LICENSE_URL = 'https://cwip-shaka-proxy.appspot.com/no_auth'
Expand Down Expand Up @@ -157,6 +155,12 @@ def listVideos(self, lVideos):
def playVideo(self,videoId):
xbmc.log("plugin.video.3cat -UI - playVideo " + str(videoId))

if str(videoId).lower().startswith("http"):
xbmc.log("plugin.video.3cat - UI - is stream link")
# Simple MP4 playback
xbmc.Player().play(videoId)
return

apiJsonUrl = "https://api-media.3cat.cat/pvideo/media.jsp?media=video&versio=vast&idint={}&profile=pc_3cat&format=dm".format(
videoId)
xbmc.log("plugin.video.3cat - UI - playVideo apijson url" + str(apiJsonUrl))
Expand Down
Loading

0 comments on commit a24d50e

Please sign in to comment.