easy-playlist


Nameeasy-playlist JSON
Version 1.7.2 PyPI version JSON
download
home_pagehttps://github.com/ThePhoenix78/easy-playlist
SummaryA library to easily manage your playlists in python
upload_time2023-11-17 14:09:59
maintainer
docs_urlNone
authorThePhoenix78
requires_python
licenseMIT
keywords playlist music timer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # easy-playlist

**A library to easily manage yours playlists in python**

## Getting started

1. [**Installation**](#installation)
2. [**Usages**](#usages)
3. [**Code example**](#code-example)
4. [**Documentation**](https://github.com/ThePhoenix78/easy-playlist/blob/main/DOCUMENTATION.md)


## Installation

**This library will work with python 3.6+**

PyPi : `pip install easy-playlist`

GitHub : [Github](https://github.com/ThePhoenix78/easy-playlist)


## Usages

This library will work with any .mp3 files
It's was desinged to work with bots in general


## Code example

### Simple tasks

```py
from easy_playlist import Playlists

pls = Playlists()
pl = pls.add_playlist("test")
# pl = pls.get_playlist("test")

# add music to your playlist
pl.add_music("path_to_music.mp3")
pl.add_music(["path_to_music.mp3", "path_to_other_music.mp3"])

# trigger the timer
# this will take the first song of the playlist
pl.play()

# pause the timer
pl.pause()

# resume the timer
pl.resume()

# stop the current music and trigger the timer for the next one
pl.next()

# stop the current music and trigger the timer for the previous one
pl.previous()

# stop the timer and the music
pl.stop()

# IMPORTANT
# when you don't need to use the playlist anymore do this
# this library use a thread to calculate the time
pl.exit()
```

### To make it work with a bot

```py
from easy_playlist import Playlists

# any bot library
bot = Bot()
pls = Playlists()
pl = pls.add_playlist("test")

# pl = pls.get_playlist("test")


# code example


@bot.command()
def add_music(music):
	pl.add_music(music)


@bot.command()
def pause():
	pl.pause()
	bot.pause_music()


@bot.command()
def resume():
	pl.resume()
	bot.resume_music()


@bot.command()
def play(music):
	pl.play(music)
	bot.play_music(music)


@pl.on_music_over()
def music_over(data):
	print(f"{data.playlist.name} {data.music.name} is over, playing next now")
	pl.next()
	bot.play_music(pl.get_current().file)

```

### An other code to explain

```py
pl = Playlists()
pl1 = pl.add_playlist(name="test1", playlist=["music/bip1.mp3", "music/bip2.mp3"])
pl2 = pl.add_playlist(name="test2", playlist=["music/bip1.mp3", "music/bip2.mp3"])
pl.add_music("test1", "music/bip3.mp3")
# pl1.add_music("music/bip3.mp3")

# pl1 = pl.get_playlist("test1")
# pl2 = pl.get_playlist("test2")

pl1.play()
pl2.play()

print("starting...")


@pl.on_music_over()
def music_over(data):
    print(f"[{data.playlist.name}] {data.music.name} is over, next song now!")

    if data.playlist.is_over():
        print(f"Playlist {data.playlist.name} is over")
        data.playlist.clear()
        return

    data.playlist.next()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ThePhoenix78/easy-playlist",
    "name": "easy-playlist",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "playlist,music,timer",
    "author": "ThePhoenix78",
    "author_email": "thephoenix788@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bd/07/8013488f398a12b2f268fedb618e56e76fb8909fd55b51cd7aeb39b77af2/easy-playlist-1.7.2.tar.gz",
    "platform": null,
    "description": "# easy-playlist\r\n\r\n**A library to easily manage yours playlists in python**\r\n\r\n## Getting started\r\n\r\n1. [**Installation**](#installation)\r\n2. [**Usages**](#usages)\r\n3. [**Code example**](#code-example)\r\n4. [**Documentation**](https://github.com/ThePhoenix78/easy-playlist/blob/main/DOCUMENTATION.md)\r\n\r\n\r\n## Installation\r\n\r\n**This library will work with python 3.6+**\r\n\r\nPyPi : `pip install easy-playlist`\r\n\r\nGitHub : [Github](https://github.com/ThePhoenix78/easy-playlist)\r\n\r\n\r\n## Usages\r\n\r\nThis library will work with any .mp3 files\r\nIt's was desinged to work with bots in general\r\n\r\n\r\n## Code example\r\n\r\n### Simple tasks\r\n\r\n```py\r\nfrom easy_playlist import Playlists\r\n\r\npls = Playlists()\r\npl = pls.add_playlist(\"test\")\r\n# pl = pls.get_playlist(\"test\")\r\n\r\n# add music to your playlist\r\npl.add_music(\"path_to_music.mp3\")\r\npl.add_music([\"path_to_music.mp3\", \"path_to_other_music.mp3\"])\r\n\r\n# trigger the timer\r\n# this will take the first song of the playlist\r\npl.play()\r\n\r\n# pause the timer\r\npl.pause()\r\n\r\n# resume the timer\r\npl.resume()\r\n\r\n# stop the current music and trigger the timer for the next one\r\npl.next()\r\n\r\n# stop the current music and trigger the timer for the previous one\r\npl.previous()\r\n\r\n# stop the timer and the music\r\npl.stop()\r\n\r\n# IMPORTANT\r\n# when you don't need to use the playlist anymore do this\r\n# this library use a thread to calculate the time\r\npl.exit()\r\n```\r\n\r\n### To make it work with a bot\r\n\r\n```py\r\nfrom easy_playlist import Playlists\r\n\r\n# any bot library\r\nbot = Bot()\r\npls = Playlists()\r\npl = pls.add_playlist(\"test\")\r\n\r\n# pl = pls.get_playlist(\"test\")\r\n\r\n\r\n# code example\r\n\r\n\r\n@bot.command()\r\ndef add_music(music):\r\n\tpl.add_music(music)\r\n\r\n\r\n@bot.command()\r\ndef pause():\r\n\tpl.pause()\r\n\tbot.pause_music()\r\n\r\n\r\n@bot.command()\r\ndef resume():\r\n\tpl.resume()\r\n\tbot.resume_music()\r\n\r\n\r\n@bot.command()\r\ndef play(music):\r\n\tpl.play(music)\r\n\tbot.play_music(music)\r\n\r\n\r\n@pl.on_music_over()\r\ndef music_over(data):\r\n\tprint(f\"{data.playlist.name} {data.music.name} is over, playing next now\")\r\n\tpl.next()\r\n\tbot.play_music(pl.get_current().file)\r\n\r\n```\r\n\r\n### An other code to explain\r\n\r\n```py\r\npl = Playlists()\r\npl1 = pl.add_playlist(name=\"test1\", playlist=[\"music/bip1.mp3\", \"music/bip2.mp3\"])\r\npl2 = pl.add_playlist(name=\"test2\", playlist=[\"music/bip1.mp3\", \"music/bip2.mp3\"])\r\npl.add_music(\"test1\", \"music/bip3.mp3\")\r\n# pl1.add_music(\"music/bip3.mp3\")\r\n\r\n# pl1 = pl.get_playlist(\"test1\")\r\n# pl2 = pl.get_playlist(\"test2\")\r\n\r\npl1.play()\r\npl2.play()\r\n\r\nprint(\"starting...\")\r\n\r\n\r\n@pl.on_music_over()\r\ndef music_over(data):\r\n    print(f\"[{data.playlist.name}] {data.music.name} is over, next song now!\")\r\n\r\n    if data.playlist.is_over():\r\n        print(f\"Playlist {data.playlist.name} is over\")\r\n        data.playlist.clear()\r\n        return\r\n\r\n    data.playlist.next()\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library to easily manage your playlists in python",
    "version": "1.7.2",
    "project_urls": {
        "Download": "https://github.com/ThePhoenix78/easy-playlist/tarball/master",
        "Homepage": "https://github.com/ThePhoenix78/easy-playlist"
    },
    "split_keywords": [
        "playlist",
        "music",
        "timer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "505cdcb37d4a0d06d0029a1bb64d02e0f0d9686452f1057526f128e8299514e1",
                "md5": "50063bc770f02745966a57b9ed634b05",
                "sha256": "cbcb49de37846896dd9c5a3158bdcd145e30ccb71dc42eb38c92023bf5d194a5"
            },
            "downloads": -1,
            "filename": "easy_playlist-1.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "50063bc770f02745966a57b9ed634b05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6129,
            "upload_time": "2023-11-17T14:09:57",
            "upload_time_iso_8601": "2023-11-17T14:09:57.772312Z",
            "url": "https://files.pythonhosted.org/packages/50/5c/dcb37d4a0d06d0029a1bb64d02e0f0d9686452f1057526f128e8299514e1/easy_playlist-1.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd078013488f398a12b2f268fedb618e56e76fb8909fd55b51cd7aeb39b77af2",
                "md5": "14221a20a5f00fff31c2ddba8c915c2a",
                "sha256": "6643752bfa47f3aaeddd16b737d20f6f739c60ff880a2d7c9f44297447845b6d"
            },
            "downloads": -1,
            "filename": "easy-playlist-1.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "14221a20a5f00fff31c2ddba8c915c2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6120,
            "upload_time": "2023-11-17T14:09:59",
            "upload_time_iso_8601": "2023-11-17T14:09:59.907794Z",
            "url": "https://files.pythonhosted.org/packages/bd/07/8013488f398a12b2f268fedb618e56e76fb8909fd55b51cd7aeb39b77af2/easy-playlist-1.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-17 14:09:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ThePhoenix78",
    "github_project": "easy-playlist",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "easy-playlist"
}
        
Elapsed time: 0.15179s