mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-28 15:53:51 +01:00
Media (Windows): detect with external DLL
For backup only
This commit is contained in:
+23
-14
@@ -19,21 +19,30 @@ void ffPrintPlayer(FFPlayerOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
if (media->player.length == 0)
|
||||
{
|
||||
ffPrintError(FF_PLAYER_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No media player detected");
|
||||
return;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY playerPretty = ffStrbufCreate();
|
||||
|
||||
//If we are on a website, prepend the website name
|
||||
if(
|
||||
ffStrbufIgnCaseCompS(&media->playerId, "spotify") == 0 ||
|
||||
ffStrbufIgnCaseCompS(&media->playerId, "vlc") == 0
|
||||
) {} // do noting, surely not a website, even if the url is set
|
||||
else if(ffStrbufStartsWithS(&media->url, "https://www."))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 12);
|
||||
else if(ffStrbufStartsWithS(&media->url, "http://www."))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 11);
|
||||
else if(ffStrbufStartsWithS(&media->url, "https://"))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 8);
|
||||
else if(ffStrbufStartsWithS(&media->url, "http://"))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 7);
|
||||
if (media->url.length > 0)
|
||||
{
|
||||
//If we are on a website, prepend the website name
|
||||
if(
|
||||
ffStrbufIgnCaseEqualS(&media->playerId, "spotify") ||
|
||||
ffStrbufIgnCaseEqualS(&media->playerId, "vlc")
|
||||
) {} // do noting, surely not a website, even if the url is set
|
||||
else if(ffStrbufStartsWithS(&media->url, "https://www."))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 12);
|
||||
else if(ffStrbufStartsWithS(&media->url, "http://www."))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 11);
|
||||
else if(ffStrbufStartsWithS(&media->url, "https://"))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 8);
|
||||
else if(ffStrbufStartsWithS(&media->url, "http://"))
|
||||
ffStrbufAppendS(&playerPretty, media->url.chars + 7);
|
||||
}
|
||||
|
||||
//If we found a website name, make it more pretty
|
||||
if(playerPretty.length > 0)
|
||||
@@ -68,7 +77,7 @@ void ffPrintPlayer(FFPlayerOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &playerPretty, "player"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &media->player, "name"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &media->playerId, "id"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &media->url, "url"}
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &media->url, "url"},
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user