Skip to content

Commit 31588cb

Browse files
authored
Merge pull request #4704 from jaylinski/plugin.audio.soundcloud
[plugin.audio.soundcloud] 4.1.0
2 parents 397bf4d + 7dfadfc commit 31588cb

File tree

10 files changed

+92
-22
lines changed

10 files changed

+92
-22
lines changed

plugin.audio.soundcloud/addon.xml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="plugin.audio.soundcloud" name="SoundCloud" version="4.0.2" provider-name="jaylinski">
2+
<addon id="plugin.audio.soundcloud" name="SoundCloud" version="4.1.0" provider-name="jaylinski">
33
<requires>
44
<import addon="xbmc.python" version="3.0.0"/>
5-
<import addon="script.module.requests" version="2.22.0"/>
5+
<import addon="script.module.requests" version="2.29.0"/>
66
</requires>
77
<extension point="xbmc.python.pluginsource" library="addon.py">
88
<provides>audio</provides>
99
</extension>
1010
<extension point="xbmc.addon.metadata">
1111
<summary lang="de_DE">SoundCloud – Musik- und Podcast-Streaming-Plattform</summary>
1212
<summary lang="en_GB">SoundCloud – Music and podcast streaming platform</summary>
13+
<summary lang="nl_NL">SoundCloud – Muziek- en podcaststreamingplatform</summary>
1314
<description lang="de_DE">SoundCloud ist eine Musik- und Podcast-Streaming-Plattform, mit der Du Millionen von Songs aus der ganzen Welt anhören kannst.</description>
1415
<description lang="en_GB">SoundCloud is a music and podcast streaming platform that lets you listen to millions of songs from around the world.</description>
16+
<description lang="nl_NL">SoundCloud is een muziek- en podcaststreamingplatform waarmee je naar miljoenen nummers van over de hele wereld kunt luisteren.</description>
1517
<disclaimer lang="en_GB">This plugin is not official, approved or endorsed by SoundCloud.</disclaimer>
18+
<disclaimer lang="nl_NL">Deze plugin is niet officieel, goedgekeurd of gesteund door SoundCloud.</disclaimer>
1619
<platform>all</platform>
1720
<license>MIT</license>
1821
<forum>https://forum.kodi.tv/showthread.php?tid=206635</forum>
1922
<website>https://soundcloud.com</website>
2023
<source>https://github.com/jaylinski/kodi-addon-soundcloud</source>
21-
<news>4.0.2 (2022-03-13)
24+
<news>4.1.0 (2025-10-06)
25+
Fixed error when using addon
26+
Added description and follower-counts to user profiles
27+
Added description and likes to playlists
28+
Added playcount to tracks
29+
Updated Dutch translations
30+
31+
4.0.2 (2022-03-13)
2232
Fixed random CloudFront errors when sending requests
2333
Added context-menu option for removing search-history items
2434

plugin.audio.soundcloud/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img align="right" src="https://github.com/xbmc/xbmc/raw/master/addons/webinterface.default/icon-128.png" alt="Kodi logo">
44

55
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/jaylinski/kodi-addon-soundcloud.svg)](https://github.com/jaylinski/kodi-addon-soundcloud/releases)
6-
[![Build Status](https://img.shields.io/github/workflow/status/jaylinski/kodi-addon-soundcloud/Continuous%20Integration/master.svg)](https://github.com/jaylinski/kodi-addon-soundcloud/actions)
6+
[![CI Build Status](https://github.com/jaylinski/kodi-addon-soundcloud/actions/workflows/ci.yml/badge.svg)](https://github.com/jaylinski/kodi-addon-soundcloud/actions)
77
[![Link to Kodi forum](https://img.shields.io/badge/Kodi-Forum-informational.svg)](https://forum.kodi.tv/showthread.php?tid=206635)
88
[![Link to Kodi wiki](https://img.shields.io/badge/Kodi-Wiki-informational.svg)](https://kodi.wiki/view/Add-on:SoundCloud)
99
[![Link to Kodi releases](https://img.shields.io/badge/Kodi-v19%20%22Matrix%22-green.svg)](https://kodi.wiki/view/Releases)
@@ -51,7 +51,7 @@ This add-on uses [Pipenv](https://pypi.org/project/pipenv/) to manage its depend
5151

5252
### Setup
5353

54-
[Install Pipenv](https://pipenv.readthedocs.io/en/latest/install/#installing-pipenv) and run `pipenv install --dev`.
54+
[Install Pipenv](https://pipenv.pypa.io/en/latest/installation.html#installing-pipenv) and run `pipenv install --dev`.
5555

5656
### Build
5757

plugin.audio.soundcloud/resources/language/resource.language.de_de/strings.po

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,11 @@ msgstr "In deinem Land nicht verfügbar"
146146
msgctxt "#30903"
147147
msgid "Preview"
148148
msgstr "Vorschau"
149+
150+
msgctxt "#30904"
151+
msgid "followers"
152+
msgstr "Follower"
153+
154+
msgctxt "#30905"
155+
msgid "likes"
156+
msgstr "Likes"

plugin.audio.soundcloud/resources/language/resource.language.en_gb/strings.po

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,11 @@ msgstr ""
146146
msgctxt "#30903"
147147
msgid "Preview"
148148
msgstr ""
149+
150+
msgctxt "#30904"
151+
msgid "followers"
152+
msgstr ""
153+
154+
msgctxt "#30905"
155+
msgid "likes"
156+
msgstr ""

plugin.audio.soundcloud/resources/language/resource.language.nl_nl/strings.po

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Report-Msgid-Bugs-To: [email protected]\n"
99
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
1010
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11-
"Last-Translator: Jan Hekkerman\n"
11+
"Last-Translator: Miniontoby\n"
1212
"MIME-Version: 1.0\n"
1313
"Content-Type: text/plain; charset=UTF-8\n"
1414
"Content-Transfer-Encoding: 8bit\n"
@@ -46,11 +46,11 @@ msgstr ""
4646

4747
msgctxt "#30061"
4848
msgid "Client-ID"
49-
msgstr ""
49+
msgstr "Client ID"
5050

5151
msgctxt "#30062"
5252
msgid "Localization"
53-
msgstr ""
53+
msgstr "Localisatie"
5454

5555
msgctxt "#30063"
5656
msgid "auto"
@@ -144,4 +144,12 @@ msgstr "Niet beschikbaar in jouw land"
144144

145145
msgctxt "#30903"
146146
msgid "Preview"
147+
msgstr "Voorbeeld"
148+
149+
msgctxt "#30904"
150+
msgid "followers"
151+
msgstr "volgers"
152+
153+
msgctxt "#30905"
154+
msgid "likes"
147155
msgstr ""

plugin.audio.soundcloud/resources/lib/kodi/items.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@ def charts(self):
124124
items = []
125125

126126
# Top 50
127-
list_item = xbmcgui.ListItem(label=format_bold(self.addon.getLocalizedString(30301)))
128-
url = self.addon_base + PATH_CHARTS + "?" + urllib.parse.urlencode({
129-
"action": "top"
130-
})
131-
items.append((url, list_item, True))
127+
# TOOD Not working anymore, replace with new GraphQL API
128+
# list_item = xbmcgui.ListItem(label=format_bold(self.addon.getLocalizedString(30301)))
129+
# url = self.addon_base + PATH_CHARTS + "?" + urllib.parse.urlencode({
130+
# "action": "top"
131+
# })
132+
# items.append((url, list_item, True))
132133

133134
# Trending
134135
list_item = xbmcgui.ListItem(label=format_bold(self.addon.getLocalizedString(30302)))
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from resources.lib.models.list_item import ListItem
22
import urllib.parse
3+
import xbmcaddon
34
import xbmcgui
45

6+
likes = xbmcaddon.Addon().getLocalizedString(30905)
7+
58

69
class Playlist(ListItem):
710
thumb = ""
@@ -11,12 +14,24 @@ class Playlist(ListItem):
1114
def to_list_item(self, addon_base):
1215
list_item = xbmcgui.ListItem(label=self.label, label2=self.label2)
1316
list_item.setArt({"thumb": self.thumb})
14-
list_item.setInfo("music", {
15-
"title": self.label
17+
list_item.setIsFolder(True)
18+
list_item.setProperty("isPlayable", "false")
19+
# We have to use the `video`-type in order to display a proper folder description
20+
list_item.setInfo("video", {
21+
"plot": self._get_description()
1622
})
23+
1724
url = addon_base + "/?" + urllib.parse.urlencode({
1825
"action": "call",
1926
"call": "/playlists/{id}".format(id=self.id)
2027
})
2128

2229
return url, list_item, True
30+
31+
def _get_description(self):
32+
return "{}\n{} {}\n\n{}".format(
33+
self.info.get("artist"),
34+
self.info.get("likes"),
35+
likes,
36+
self.info.get("description") or ""
37+
)

plugin.audio.soundcloud/resources/lib/models/track.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def to_list_item(self, addon_base):
2626
"genre": self.info.get("genre"),
2727
"title": self.label,
2828
"year": self.info.get("date")[:4],
29+
"playcount": self.info.get("playback_count"),
2930
"comment": self.info.get("description")
3031
})
3132
list_item.setProperty("isPlayable", "true")
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
from resources.lib.models.list_item import ListItem
22
from resources.routes import *
33
import urllib.parse
4+
import xbmcaddon
45
import xbmcgui
56

7+
followers = xbmcaddon.Addon().getLocalizedString(30904)
8+
69

710
class User(ListItem):
811
thumb = ""
@@ -11,12 +14,24 @@ class User(ListItem):
1114
def to_list_item(self, addon_base):
1215
list_item = xbmcgui.ListItem(label=self.label, label2=self.label2)
1316
list_item.setArt({"thumb": self.thumb})
14-
list_item.setInfo("music", {
15-
"title": self.info.get("description")
17+
list_item.setIsFolder(True)
18+
list_item.setProperty("isPlayable", "false")
19+
# We have to use the `video`-type in order to display a proper folder description
20+
list_item.setInfo("video", {
21+
"plot": self._get_description()
1622
})
23+
1724
url = addon_base + PATH_USER + "?" + urllib.parse.urlencode({
1825
"id": self.id,
1926
"call": "/users/{id}/tracks".format(id=self.id)
2027
})
2128

2229
return url, list_item, True
30+
31+
def _get_description(self):
32+
return "{}\n{} {}\n\n{}".format(
33+
self.label2 if self.label2 != "" else self.label,
34+
self.info.get("followers"),
35+
followers,
36+
self.info.get("description") or ""
37+
)

plugin.audio.soundcloud/resources/lib/soundcloud/api_v2.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ApiV2(ApiInterface):
2222
api_limit = 20
2323
api_limit_tracks = 50
2424
api_lang = "en"
25-
api_user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0"
25+
api_user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0"
2626
api_cache = {
2727
"discover": 120 # 2 hours
2828
}
@@ -175,7 +175,8 @@ def _map_json_to_collection(self, json_obj):
175175
user.label2 = item.get("full_name", "")
176176
user.thumb = self._get_thumbnail(item, self.thumbnail_size)
177177
user.info = {
178-
"artist": item.get("description", None)
178+
"description": item.get("description", ""),
179+
"followers": item.get("followers_count", 0)
179180
}
180181
collection.items.append(user)
181182

@@ -185,7 +186,9 @@ def _map_json_to_collection(self, json_obj):
185186
playlist.label2 = item.get("label_name", "")
186187
playlist.thumb = self._get_thumbnail(item, self.thumbnail_size)
187188
playlist.info = {
188-
"artist": item["user"]["username"]
189+
"artist": item["user"]["username"],
190+
"description": item.get("description", ""),
191+
"likes": item.get("likes_count", 0)
189192
}
190193
collection.items.append(playlist)
191194

@@ -251,7 +254,8 @@ def _build_track(self, item):
251254
"genre": item.get("genre", None),
252255
"date": item.get("display_date", None),
253256
"description": item.get("description", None),
254-
"duration": int(item["duration"]) / 1000
257+
"duration": int(item["duration"]) / 1000,
258+
"playback_count": item.get("playback_count", 0)
255259
}
256260

257261
return track
@@ -273,7 +277,7 @@ def fetch_client_id():
273277
response.encoding = "utf-8" # This speeds up `response.text` by 3 seconds
274278

275279
# Extract the API key
276-
key = re.search(r"exports={\"api-v2\".*client_id:\"(\w*)\"", response.text)
280+
key = re.search(r"client_application_id:[1-9]+,client_id:\"(\w*)\"", response.text)
277281

278282
if key:
279283
return str(key.group(1))

0 commit comments

Comments
 (0)