-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lastfm] adds youtube link to [p]lf np, adds [p]lf yt
- Loading branch information
Showing
9 changed files
with
110 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package youtube | ||
|
||
import ( | ||
"errors" | ||
"sync" | ||
) | ||
|
||
var ( | ||
youtubeServiceClient *Service | ||
youtubeServiceClientMutex sync.RWMutex | ||
) | ||
|
||
func SetYouTubeService(s *Service) { | ||
youtubeServiceClientMutex.Lock() | ||
youtubeServiceClient = s | ||
youtubeServiceClientMutex.Unlock() | ||
} | ||
|
||
func HasYouTubeService() bool { | ||
if youtubeServiceClient == nil { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
func GetYouTubeService() *Service { | ||
youtubeServiceClientMutex.RLock() | ||
defer youtubeServiceClientMutex.RUnlock() | ||
|
||
if youtubeServiceClient == nil { | ||
panic(errors.New("tried to get youtube service before cache#SetYouTubeService() was called")) | ||
} | ||
|
||
return youtubeServiceClient | ||
} |
2 changes: 1 addition & 1 deletion
2
modules/plugins/youtube/service/quota.go → services/youtube/quota.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package service | ||
package youtube | ||
|
||
import ( | ||
"sync" | ||
|
2 changes: 1 addition & 1 deletion
2
modules/plugins/youtube/service/service.go → services/youtube/service.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package service | ||
package youtube | ||
|
||
import ( | ||
"context" | ||
|
2 changes: 1 addition & 1 deletion
2
modules/plugins/youtube/service/urlfilter.go → services/youtube/urlfilter.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package service | ||
package youtube | ||
|
||
import "regexp" | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...plugins/youtube/service/urlfilter_test.go → services/youtube/urlfilter_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package service | ||
package youtube | ||
|
||
import "testing" | ||
|
||
|
c2a2fc0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[lastfm] link YouTube video in _lf np, from last.fm data, fallback to YouTube search