2014-07-22

Download audio playlists with youtube-dl search function

I'm a nut for happy, uplifting, melodic, liquid drum & bass. While a thankful user of Clementine music player, which provides me a with a streaming fix of new tracks from Digitally Imported online radio, I do keep my collections traditionally on-disk.

From time to time, I get a list of new tracks to consider adding to personal favorites. Sometimes they are already in mp3 (or appropriate) form, sometimes it is a YouTube playlist. Often, though, they come in textual format listed as one track per line as a result of a little cd /path/to/liquid/dnb && find | pastebinit | xclip or awk filtering from Last.fm's exported TSV.

E.g. I get this:
Feint    Vision Driver
Fred V & Grafix    Games People Play
Temple Cloud    One Big Family (Hybrid Minds Remix)
Gradon    Trust
Hazem Beltagui    August (Rimshox Remix)
High Contrast    All There Is (ft. Liane Carroll)
High Contrast    Almost Human (ft. Clare Maguire)
High Contrast    Emotional Vampire
High Contrast    Fearful Symmetry
High Contrast    If We Ever
High Contrast    Pink Flamingos
High Contrast    The Road Goes On Forever
Keeno    Nocturne
Only a much longer list.

(If I get a playlist instead, something like this could work.)

Now, my old manual routine was to go through the list line by line, input the query into Google search, visit the first (or appropriate) YouTube link, listen to the track, and if likable, download a higher quality of it through BitTorrent if available, or through Offliberty if not. After five or so minutes, repeat with the next line. Pretty damn tedious!

But then, 192 kbps bitrate at which YouTube streams audio of high-quality uploads is perfectly enough for everyone.

And in this new light, with the help of a wonderful open-source project, youtube-dl, one like myself can download most of those tracks instantly with a single terminal command:

youtube-dl --extract-audio \
           --default-search="ytsearch2:" \
           --batch-file keywords.list

What this does is prepend "ytsearch2:" to each line of keywords.list file, as per youtube-dl extractor descriptions, then downloads the result videos and converts them all to audio. The gist of it is that you don't need to know specific video URLs because they are discovered through the YouTube API which the method uses. Not all tracks are downloaded this way because some channels disallow discovery through the API, but most are, and the time spent on copy-pasting queries around and waiting for the related browser plugin to load is reduced to a minimum.

If you know of any good, melodic DnB (no morbid dark stuff), particularly not unlike the one in the above list, please send it this way!

2013-11-21

Sufis: The True Name of God

It so happened that Rota Fortunae had me come across this little book bursting with Sufi wisdom. One cannot (and really should not) go properly mujahideen before showing significant prudence with regard to Sufi insight.

Leafing through Idries Shah's The Way of the Sufi, I shall, with highest regard to how idiotic the whole of copyright is, plainly transcribe the best passages for you. In the name of knowledge and spiritual growth! These will be, I hereby promise, so well curated that, once all gathered here in posts, you will needn't buy the book if even for a penny.

The first batch, the one you are moments away from proof-reading for the first time, is bashing Christians, particularly their narrow view of God.

If you consider yourself a Christian (by faith, not necessarily by name), I'm sure you are aware of the fact that your God, namely Allah, is the same god that the Jews call Yahveh, and who is the undisputed father of whom you praise as Jesus of Nazareth. Islam, Judaism, and Christianity all stem from roughly the same geographical area (call it The Middle East), were devised by roughly the same ethnological groups (with exception of modern Christianity), and share an undeniably significant portion of cultural heritage. They are termed the Abrahamic religions. So if you're a Christian, a dimwit, or if you are easily offended, you should really just continue reading this post. You might learn something.

As might anyone else. Without further ado, these are really easy to grasp:

The Prayer and the Nose

I saw a man prostrating himself in prayer, and exclaimed:
'You lay the burden of your nose on the ground on the excuse that it is a requirement of prayer.'
Hakim Jami

Seeds like These

In cell and cloister, in monastery and synagogue;
Some fear hell and others dream of Paradise.
But no man who really knows the secrets of his God
Has planted seeds like this within his heart.
Omar Khayyam

The Heart

Someone went up to a madman who was weeping in the bitterest possible way.
  He said:
  'Why do you cry?'
  The madman answered:
  'I am crying to attract the pity of His heart.'
  The other told him:
  'Your words are nonsense, for He has no physical heart.'
  The madman answered:
  'It is you who are wrong, for He is the owner of all the hearts which exist. Through the heart you can make your connection with God.'
Attar of Nishapur

Worship

Man passes through three stages.
First he worships anything: man, woman, money, children, earth and stones.
Then, when he has progressed a little further, he worships God.
Finally, he does not say: 'I worship God'; nor: 'I do not worship God.'
He has passed from the first two stages into the last.

Praying for Oneself

Sa'ad son of Wakas was a companion of the Prophet. In the last years he became blind and settled in Mecca, where he was always surrounded by people seeking his blessing. He did not bless everyone, but those whom he did always found the way smoothed for them.
Abdallah Ibn-Sa'ad reports: 'I went to see him, and he was good to me and give me his blessing. As I was only a curious child, I asked him: "Your prayers for others always seem to be answered. Why, then, do you not pray for your blindness to be removed?"
The ancient replied: "Submission to the Will of God is far better than the personal pleasure of being able to see."'

Truth

She has confused all the learned of Islam,
Everyone who has studied the Psalms,
Every Jewish Rabbi,
Every Christian priest.
Ibn El-Arabi


Surely, you are soaking wet between your legs for the joy you were experiencing while reading this. The next batch, themed of life and death, is in the works. By Sufis.

2013-08-25

Recipe: Vanilla / Chocolate / Fruit-Jello Pudding (4-in-1 combo)

So I was amazed to see today how easy it is to make a delicious homemade pudding from scratch (as to avoid pre-made mixture bags with shitloads of stabilizers, flavor-enhancers, and GMO starch), and how generally the procedure applies to just any type of pudding (vanilla, chocolate, coconut, peanutbutter, you name it!), including fruit jello, which you can make from your favourite kompot.

As they often say how computer algorithms are similar to culinary recipes, I decided to write this recipe in Pythonic dialect of English. You should have no trouble understanding it.

2013-08-10

Parsing package dependencies

So I'm dealing with package dependencies such as Debian's, where , delimits AND dependencies (i.e. all of these) and | OR dependencies (i.e. any of these). I have some naive code that works, but inspired with wisdom from Norvig's CS212, I spark to refactoring it.