Open p-hash opened 3 years ago
Oh cool, I was unaware there was a new plugin. Thanks for the heads up!
This looks cool. What are actual advantages of this plugin over plugin.video.youtube? I can't find them listed anywhere.
The advantage is being able to create playlists and channels outside of an account a lot like freetube, I second support for this its better than youtube plugin
Please refer to my comment here:
I'll copy and paste the important bits.
Ideally, it should just take the following changes:
Create resources/lib/apis/tubed_api.py
, and define a new AbstractApi
implementation named TubedApi
.
A minimal implementation could look like this, though it won't preload segments:
from six.moves.urllib import parse as urlparse
from .abstract_api import AbstractApi
from .models import NotificationPayload
from ..utils.xbmc import get_playing_file_path
class TubedApi(AbstractApi):
def parse_notification_payload(self, data): # type: (str) -> NotificationPayload | None
return None
def get_video_id(self): # type: () -> str | None
try:
path_url = urlparse.urlsplit(get_playing_file_path())
query = urlparse.parse_qs(path_url.query)
except Exception:
return None
valid_url = (
path_url.scheme == "plugin"
and path_url.path.startswith("/")
)
return query.get("video_id")[0] if valid_url else None
def should_preload_segments(self, method, data): # type: (str, NotificationPayload) -> bool
return False
In resources/lib/apis/api_factory.py
, update API_MAP
to include a mapping of the Kodi addon ID to the respective AbstractAPI
implementation:
from .invidious_api import InvidiousApi
from .youtube_api import YouTubeApi
from .tubed_api import TubedApi
# …
API_MAP = {
"plugin.video.youtube": YouTubeApi,
"plugin.video.invidious": InvidiousApi,
"plugin.video.tubed": TubedApi
}
Finally, in addon.xml
, update the context-menu extension point to also show on the plugin.video.tubed
app. This will show the button to configure Kodi SponsorBlock settings on the app.
<visible>String.IsEqual(ListItem.Property(Addon.ID),plugin.video.youtube) | String.IsEqual(ListItem.Property(Addon.ID),plugin.video.invidious) | String.IsEqual(ListItem.Property(Addon.ID),plugin.video.tubed)</visible>
If someone who uses plugin.video.tubed could test this, feel free to do a PR. It would be even better if you could implement the #parse_notification_payload
and #should_preload_segments
functions, but the extension will work without them. :+1:
Tubed is a newer kodi youtube plugin from the same developer. I think it is better to use it instead of plugin.video.youtube
Links: https://forum.kodi.tv/showthread.php?tid=358806 https://github.com/anxdpanic/plugin.video.tubed
TubeCast is already using Tubed: https://github.com/enen92/script.tubecast/commit/8d30ef170cc8156ac20e6bedeb2e27ed61dd15ef