Hal: Your swiss knife to perform fast and easy pythonic stuff¶
Release v10.2.7
Table of contents¶
API reference¶
Behold, the power of Hal¶
Edit songs tags¶
Classic way¶
>>> import os
>>> from mutagen.mp3 import MP3
>>> my_folder = "path to folder containing songs"
>>> for root, dirs, files in os.walk(my_folder):
>>> for file in files:
>>> audio = MP3(file)
>>> audio["artist"] = "An example"
>>> audio.save()
Using Hal
¶
>>> from hal.files.models.system import ls_recurse
>>> from hal.files.models.audio import MP3Song
>>> my_folder = "path to folder containing songs"
>>> for file in ls_recurse(my_folder):
>>> MP3Song(file).set_artist("An example")
Plot data¶
Classic way¶
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> x = np.arange(1., 100.)
>>> y = np.sin(x)
>>> plt.plot(x, y)
>>> plt.show()
Using Hal
¶
>>> import numpy as np
>>> from hal.charts.plotter import Plot2d
>>> Plot2d().plot(np.sin, 1, 100, 100)
Get YouTube RSS feed of channel¶
Classic way¶
No easy way that I know of
Using Hal
¶
>>> from hal.internet.services.youtube import YoutubeChannel
>>> video_url = "my awesome video of an awesome channel"
>>> channel_feed = YoutubeChannel.get_feed_url_from_video(video_url)
>>> # or if you know the name
>>> channel_name = "my awesome channel"
>>> channel_feed = YoutubeChannel(channel_name).get_feed_url()
Install¶
Different ways, all equals
via pipenv
¶
$ pipenv install .
$ make install
via pip
¶
$ pip3 install PyHal
$ make pip-install
fast install¶
make fast-init
just copies source files to distribution files … run it only if you’re sure about dependencies
Contributing and feedback¶
- open an issue
- fork this repository
- create your feature branch (
git checkout -b my-new-feature
) - commit your changes (
git commit -am 'Added my new feature'
) - publish the branch (
git push origin my-new-feature
) - open a PR
Suggestions and improvements are welcome!
Authors¶
Stefano Fogarollo |
Thanks to¶
License¶
GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007
Copyright (c) Stefano Fogarollo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.