91 Commits

Author SHA1 Message Date
NIXC
96a91b9d0e [Audio] Add ability to skip to a specified track by number (#2584)
* add skip to track functionality

* formatting

* Change some strings

* missing return, variable naming

* add variable names for translations

* change handling of skipping 1 track

* minor semantic adjustments

skiptotrack -> skip_to_track
2019-05-08 01:34:37 -04:00
aikaterna
65b88c09fb [Audio] Update for Red-Lavalink 0.3.x (#2547)
* [Audio] Update for Red-Lavalink #55

* Update setup.cfg

* Catch all the exceptions

* Update version range on Red-Lavalink

* Catch excepts on Spotify tracks/playlist upload

* No prefix needed
2019-05-08 00:56:40 -04:00
Will
bb6327d969
[Audio] Fix architecture blacklisting (#2634) 2019-04-30 12:32:16 -04:00
Toby Harradine
476f441c9b [Audio] Refactor internal Lavalink server management (#2495)
* Refactor internal Lavalink server management

Killing many birds with one stone here.
- Made server manager into class-based API with two public methods: `start()` and `shutdown()`. Must be re-instantiated each time it is restarted.
- Using V3 universal Lavalink.jar hosted on Cog-Creators/Lavalink-Jars repository.
- Uses output of `java -jar Lavalink.jar --version` to check if a new jar needs to be downloaded.
- `ServerManager.start()` won't return until server is ready, i.e. when "Started Launcher in X seconds" message is printed to STDOUT.
- `shlex.quote()` is used so spaces in path to Lavalink.jar don't cause issues.
- Enabling external Lavalink will cause internal server to be terminated.
- Disabling internal Lavalink will no longer reset settings in config - instead, hard-coded values will be used when connecting to an internal server.
- Internal server will now run both WS and REST servers on port 2333, meaning one less port will need to be taken up.
- Now using `asyncio.subprocess` module so waiting on and reading from subprocesses can be done asynchronously.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Don't use shlex.quote on Windows

Signed-off-by: Toby <tobyharradine@gmail.com>

* Don't use shlex.quote at all

I misread a note in the python docs and assumed it was best to use it. Turns out the note only applies to `asyncio.create_subprocess_shell`.

Signed-off-by: Toby <tobyharradine@gmail.com>

* Missed the port on the rebase

* Ignore invalid architectures and inform users when commands are used.

* Style fix
2019-04-29 21:31:28 -04:00
aikaterna
c1bee3fee5 [V3 Audio] Add settable path for external Lavalink (#2480) 2019-04-29 18:34:09 -04:00
aikaterna
d786103d8d [Audio] Set cwd for localtracks on playlist start (#2534) 2019-04-29 18:28:44 -04:00
Michael H
ad114295e7
Discord.py dep update 3.1 (#2587)
* Dependency update

discord.py==1.0.1
websockets<7

[style]
black==19.3b0

[Docs]
jinja==2.10.1
urllib3==1.24.2

Changes related to breaking changes from discord.py have also been made
to match

As of this commit, help formatter is back to discord.py's default
2019-04-23 21:40:38 -04:00
aikaterna
0ff7259bc3 [Audio] DJ role should ask for a role (#2606) 2019-04-23 18:41:46 -04:00
zephyrkul
ee11d7da63 [V3 Audio] Cancel emptydisconnect when no longer alone (#2519)
* [audio] cancel disconnect when no longer alone

* [audio] fix modifying while iterating
2019-04-22 20:05:37 -04:00
aikaterna
005123a371 [Audio] Fix for playlist queue when not playing (#2586) 2019-04-22 19:17:44 -04:00
aikaterna
bb8ce43cc0 [Audio] Track search and append fixes (#2591)
* [Audio] Track search and append fixes

* Appeasing the style gods
2019-04-22 19:17:17 -04:00
PredaaA
ad06b0e723 [Audio] Fix issue on audiostats command when more than 20 servers to display (#2533)
* Update audio.py

* Fix of pages counter.
2019-04-18 12:12:16 -04:00
jack1142
e347ffa336 Bot can join voice channel with user limit if it has move members perm (#2525) 2019-04-09 20:33:19 -04:00
aikaterna
39b64b7570 [Audio] Fix for localtrack playing (#2557) 2019-04-09 17:13:57 -04:00
aikaterna
56b220b92e [Audio] Fix for prev command display (#2556) 2019-04-09 17:10:25 -04:00
aikaterna
de7d08ee75 [Audio] Match v2 behavior for channel change (#2521)
* [Audio] Match v2 behavior for channel change

* Use move_to instead of connect
2019-04-02 22:22:57 -04:00
aikaterna
2a486cad66 [V3 Audio] Playlist info improvements (#2274)
* [V3 Audio] Playlist info improvements

* Add pagify import, reformat for Black

* Change from code block to embed with links
2019-04-02 21:48:21 -04:00
aikaterna
80fc639480 [V3 Audio] Queue clean and queue clear addition (#2476)
* [V3 Audio] Queue clean and queue clear addition

* Use DJ role and existing checks inst. of mod/admin

* Remove unneeded .format()
2019-04-02 21:12:55 -04:00
aikaterna
050300040c [V3 Audio] Add Spotify support (#2328)
* [V3 Audio] Add Spotify support

* [V3 Audio] Update LICENSE

* Appeasing the style gods

* Extra word removal on LICENSE

* Update for #2389

Thanks to TrustyJAID for the help.

* Playlist command support for Spotify URLs or codes

* Add exception for dc while loading Spotify tracks

* Allow Spotify urls by default in audioset restrict

Matches the behavior of Spotify codes already being allowed by default.

* Update audio.py

* .format() moving

* Added a character to try to make Travis behave
2019-03-28 13:41:17 -04:00
aikaterna
94c3a2fedd [Audio] Seek command can now seek to position (#2470)
- Seek can now seek to a specific position, formatted like 00:00:00 or 00:00. Using negative or positive ints still functions the same as previously and will seek ahead or behind by that value instead.
- This PR requires the `_time_convert` func added in #2465 and should be merged after that one.
2019-03-10 18:27:23 +11:00
aikaterna
421043d923 [Audio] Fix for audioset status (#2481)
Revert player.is_playing check added to the playing players list for audioset status in #2473. This addition would cause no status to be shown when a local track was played and skip was used.
2019-03-08 09:09:22 +11:00
aikaterna
1c22b212c2 [Audio] Add songs when search-queuing (#2513)
Searching for a song and pressing the reaction to queue a song would not add the song to the queue if `[p]audioset maxlength` was off. This was an omission from #2465.
2019-03-07 14:12:15 +11:00
aikaterna
15037013e7 [Audio] Add option for dc at queue end (#2472)
This addition adds a toggle for having the bot instantly disconnect when the queue ends. It takes precedence over the `[p]audioset emptydisconnect` setting as it disconnects immediately when the queue or single song is finished.
2019-03-04 14:16:26 +11:00
Toby Harradine
628073cbe1
Update Translations (#2486)
Also included a Makefile recipe which makes use of the Crowdin CLI's `crowdin download` command. This requires whoever is using it to provide the project's API key in an environment variable, but we may automate this at some point.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-03-04 08:55:01 +11:00
aikaterna
2755592175 [Audio] Playlist download addition (#2482)
Bot owners can use `[p]playlist download playlistname` to download a playlist file that is compatible with the playlist upload command. Songs can also be exported for v2 use by using `[p]playlist download playlistname True`, which strips out tracks besides YouTube or Soundcloud URLs.
2019-03-03 14:29:42 +11:00
El Laggron
46f9cae0ef [Audio] Sort local files (#2358) 2019-02-27 16:22:10 +11:00
aikaterna
b0ab6bd7e2 [Audio] Add track length restriction (#2465)
* Added `[p]audioset maxlength`, which takes seconds or 00:00-style of formatted input for restricting the player to songs that have a length under that threshold.
2019-02-24 11:44:58 +11:00
aikaterna
7b9d85c1b5 [Audio] Emptydisconnect and status refactor (#2473)
- Refactored disconnect_timer, the function behind audioset emptydisconnect, to be more appropriately responsive (thanks to TrustyJAID)
- Refactored status clearing/status changing when emptydisconnect or other Lavalink player statuses would have a TRACK_END event but no QUEUE_END event. This should clear or modify the bot's status event appropriately when [p]audioset status is on and the bot disconnects due to emptydisconnect and ideally play a little nicer with other cogs that set statuses.
2019-02-23 08:45:01 +11:00
aikaterna
16bb334fba [Audio] Add playlist copy (#2205)
Bot owners can now copy playlists from one server to another using server IDs.
2019-02-19 10:36:20 +11:00
aikaterna
7e2e37ab3f [Audio] Play local folders via text command (#2457)
`[p]local folder` will now accept folder names in the command instead of having to navigate through the reaction menu. Also added an alias of `[p]local start` to help users coming from v2 audio.
2019-02-19 10:16:41 +11:00
aikaterna
83411d0fa4 [Audio] Change pause to a toggle (#2461) 2019-02-19 10:10:11 +11:00
aikaterna
d608dd953b [Audio] Remove aliases (#2462) 2019-02-19 10:08:59 +11:00
Caleb Johnson
8e6db0829c [Audio] Connect to lavalink in the background (#2460)
Also:
- restart and reconnect if connection settings change
  - shutdown and restart if not configured to use external
- show a message in [p]play et al. when the connection hasn't been made
- move the JAR download to manager so audio.py can access it
- only start if no process exists
- bump red-lavalink to 0.2.3

Resolves #2306
2019-02-17 09:22:55 +11:00
Toby Harradine
f2daf0be9a
Revert "[Audio] Connect to lavalink in the background (#2335)" (#2459)
This reverts commit b633a33137d11404e34c6d3eee4bbc3f6061f291.
2019-02-16 11:52:03 +11:00
Caleb Johnson
b633a33137 [Audio] Connect to lavalink in the background (#2335)
Also:
- restart and reconnect if connection settings change
  - shutdown and restart if not configured to use external
- show a message in [p]play et al. when the connection hasn't been made
- move the JAR download to manager so audio.py can access it
- only start if no process exists

Resolves #2306
2019-02-16 11:35:21 +11:00
Michael H
4b831a634a [Audio] Remove players which no longer have a guild. (#2414)
Cleanup players when the bot has one for a guild it leaves.

Bumps Red-Lavalink to v0.2.2
2019-02-16 11:15:33 +11:00
Toby Harradine
bdcb69ad37 Merge branch 'V3/release/3.0.0' into V3/develop
# Conflicts:
#	redbot/cogs/audio/audio.py
2018-12-21 13:37:32 +11:00
aikaterna
3b50ed8192 [V3 Audio] Restrict toggle for commercial sites (#2245)
* [V3 Audio] Restrict toggle for commercial sites

* Different url parsing

* Allow local tracks

* No self needed

* Change Twitch url
2018-12-13 18:31:24 +01:00
aikaterna
bbccb671b8 [Audio] Disallow seek during active vote (#2290)
Users were able to use seek to skip songs while voteskip was active. This change prevents users from doing so.
2018-11-24 10:43:23 +11:00
aikaterna
d0fca373ba [Audio] Local track verify on playlist start (#2271) 2018-11-06 09:44:26 +11:00
Toby Harradine
8b2d115335
[Audio] Rename current_build to current_version in Config (#2219)
Renames the `current_build` key to `current_version`. This means the `current_version` key will always be a dict and never a list, and `current_build` having no defaults means it won't mess with `[p]audioset settings`.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-11 12:02:02 +11:00
Toby Harradine
fd0abc250d
[Audio] Fix type mismatch between config defaults and set value (#2201)
current_build is now set as a dict, but its default was a list.

This resolves the error an `[p]audioset settings`.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-07 19:33:04 +11:00
aikaterna
7b260cdafc [Audio] Playlist list, local queue, DJ Role fix (#2191)
Fix for `playlist list`: added forgotten variable plus return for formatting (fixes #2190)

i18n addditions: DJ Role toggle, Thumbnail display toggle

`audioset settings`: added missed end of line return

`queue` fix: added indentation to not have the currently playing song info repeated in the queue display when playing local songs

`local play` and `local folder` now display the appropriate menu when DJ role is on.
2018-10-07 08:42:13 +11:00
Toby Harradine
fa692ccc0b [i18n] Pass over economy, filter, general, image, mod
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 09:00:31 +10:00
Toby Harradine
3a20c11331 [i18n] User-facing string pass over admin, alias and audio 2018-10-06 08:43:19 +10:00
Toby Harradine
dea9dde637
[Utils] Finish and Refactor Predicate Utility (#2169)
* Uses classmethods to create predicates
* Classmethods allow using a combination of different parameters to describe context
* Some predicates assign a captured `result` to the predicate object on success
* Added `ReactionPredicate` equivalent to `MessagePredicate`
* Added `utils.menus.start_adding_reactions`, a non-blocking method for adding reactions asynchronously
* Added documentation
* Uses these new utils throughout the core bot
Happened to also find some bugs in places, and places where we were waiting for events without catching `asyncio.TimeoutError`

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 08:07:09 +10:00
aikaterna
b2abfc5710 [Audio] Playlist list and notify msg changes (#2155) 2018-10-01 16:44:46 +10:00
Toby Harradine
0870403299
Permissions redesign (#2149)
API changes:
- Cogs must now inherit from `commands.Cog` (see #2151 for discussion and more details)
- All functions which are not decorators in the `redbot.core.checks` module are now deprecated in favour of their counterparts in `redbot.core.utils.mod`. This is to make this module more consistent and end the confusing naming convention.
- `redbot.core.checks.check_overrides` function is now gone, overrideable checks can now be created with the `@commands.permissions_check` decorator
- Command, Group, Cog and Context have some new attributes and methods, but they are for internal use so shouldn't concern cog creators (unless they're making a permissions cog!).
- `__permissions_check_before` and `__permissions_check_after` have been replaced:  A cog method named `__permissions_hook` will be evaluated as permissions hooks in the same way `__permissions_check_before` previously was. Permissions hooks can also be added/removed/verified through the new `*_permissions_hook()` methods on the bot object, and they will be verified even when permissions is unloaded.
- New utility method `redbot.core.utils.chat_formatting.humanize_list`
- New dependency [`schema`](https://github.com/keleshev/schema)

User-facing changes:
- When a `@bot_has_permissions` check fails, the bot will respond saying what permissions were actually missing.
- All YAML-related `[p]permissions` subcommands now reside under the `[p]permissions acl` sub-group (tbh I still think the whole cog has too many top-level commands)
- The YAML schema for these commands has been changed
- A rule cannot be set as allow and deny at the same time (previously this would just default to allow)

Documentation:
- New documentation for `redbot.core.commands.requires` and `redbot.core.checks` modules
- Renewed documentation for the permissions cog
- `sphinx.ext.doctest` is now enabled

Note: standard discord.py checks will still behave exactly the same way, in fact they are checked before `Requires` is looked at, so they are not overrideable. 

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-01 13:19:25 +10:00
Toby Harradine
b2497386bb
Update dependencies (#2148)
Core dependencies:
- discord.py: Rapptz/discord.py@00a659c6 -> Rapptz/discord.py@00a659c6
- multidict: 4.4.0 -> 4.4.2

[docs]
- pyparsing: 2.2.0 -> 2.2.1
- sphinx: 1.7.8 -> 1.7.9

[test]
- pytest: 3.7.4 -> 3.8.1

[style]
- toml: 0.9.4 -> 0.9.6

----

I've also replaced usages of `discord.utils.get(guild.roles, id=id)` with the new O(1) `guild.get_role(id)` method.

Signed-off-by: Toby <tobyharradine@gmail.com>
2018-09-25 16:09:36 +10:00
Toby Harradine
df922a0e3e
[Audio] More robust startup and unload (#2118)
* More robust cleanup for audio and streams

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Remove copied code from streams

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-09-22 15:04:46 +10:00