中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 11:35
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Share] Online Music Player
Printable Version  3,136 / 15
Floor1 qinchun36 Posted 2010-11-14 03:28
高级用户 Posts 400 Credits 609
This Windows script (in WSF format) is what I use in CMD to listen to music online. The resource search service is provided by Google Music (actually it's piracy...), and the obtained music and lyrics resources seem to be provided by Juqing Music, with good quality. The most important thing is that I found the link speed is extremely fast!!!

Imagine opening a dark window and typing commands. To outsiders, it's already a very cool behavior. And you just type "Zhiziao also fell asleep" and hear the computer start playing Fish Leong's "Ningxia". The dark window even displays the lyrics along with the music, which is even cooler! Actually, it also supports downloading lyrics and songs simultaneously, which is simply all-round.

You can directly double-click it to run with the default wscript.exe, but this doesn't accept any parameters. It can only be run in the way I specified: played with wmplayer, which can only keep the lyrics;
While running with cscript.exe in the console is different. You can set parameters by yourself, provide lyrics display, and there are instructions and examples for the parameters. Take a good look. This is the situation I use most often:

Microsoft Windows XP
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Ching Chum>cd desktop

C:\Documents and Settings\Ching Chum\Desktop>cscript -nologo gMusic.wsf /p 花椰
菜之歌
http://audio9.top100.cn/201011140218/2F4A554E5C6C3CCCB9D5B83B5E21AECA/streaming
/Special_332050/M0332050001.mp3
http://lyric.top100.cn/Special_332050/M0332050001.lrc
花椰菜之歌
八十八颗芭乐籽
肆十肆只石狮子
275.0
************ 开 始 播 放 ************

摇滚乐【Rock'n'Roll】

不会放弃猴子 许多人的梦啊
梦中的那只猴子 正在练吉他
他点了点头 看着天空
蓝色和白色是今天的颜色


晚餐吃咖哩 是我的主意
但我不吃花椰菜 真是挑剔
如果能够再重来一次 世界从此改变
我会选择吃拉面 男人的口味
PLAY → 01:48 128kbps



Some additional instructions:
1. If downloading is specified while playing, it may increase the buffering time for playback. Of course, if your internet speed is good, just ignore what I said;
2. There are a total of four switches for this thing. You can use all, none, or part of them. I specially put the lyrics in the error channel. If you understand the command line, you know how to get pure lyrics without playing or downloading;
3. I personally like music very much and also support copyright. I have bought many CDs. Although this is online, it's not easy for Juqing Music to do free copyright, please don't use part of the content in this script for hotlinking or commercial behavior;
4. If you are interested in learning VBS or JS scripts, you can take a look at the source code. Basically, there are common operations on the network, which are very typical examples.


Attachment: Usage instructions

【Google Music Console】 (C)2010 Mr.Ching 『据说是李先生』
Copyright? music.Google.cn & Top100.cn

Usage: gMusic.wsf Song

Options:

Song : Relevant key words about song information, such as song title, singer, album, lyrics, etc.
p : Command line to play music, dynamic variables can be used.
If there is no command, the script plays by itself.
d : Command line to download song, dynamic variables can be used.
If there is no command, the script calls to download by itself.
s : Indicate to list all search results for selection, otherwise automatically select the first result.
If the input serial number is within the listed range, select that item and continue;
If the input serial number is less than zero, give up and exit the script;
If the input serial number is zero, turn the page and re-select;
Otherwise, re-enter is required.
l : Indicate to output lyrics in channel two (error output).

Note:
When running with wscript.exe, no parameters are accepted.
Dynamic variables refer to some specific strings used to replace the relevant information of the current song. They are:
<N> Song title
<AR> Artist
<AL> Album
<T> Total length of song in seconds
<FMT> File extension
<URL> Song link URL
<LRC> Lyrics link URL
<QT> A double quote (")

Examples:
wscript gMusic.wsf
cscript gMusic.wsf "梁祝 俞丽拿" /d:"curl <URL> -o <QT><N> - <AR>.<FMT><QT>"
cscript gMusic.wsf "because of you" /p:"wmplayer <URL>" /s /l 2>temp.txt
cscript gMusic.wsf "Dear Friend - 顺子" /d /p
cscript gMusic.wsf /p 吃一碗热腾腾的炸酱面


-------2010.11.16 Attachment modification----------
1. Corrected an order error.
2. Added a lot of comments, and attached a pdf file for easy viewing.


[ Last edited by qinchun36 on 2010-11-16 at 13:35 ]

Attachments
gMusic.wsf.zip (8.64 KiB)
gMusic.pdf.zip (370.96 KiB)
Floor2 netbenton Posted 2010-11-14 08:20
银牌会员 Posts 752 Credits 1,916 From 广西
I tried it and it didn't work. The error messages are as follows:

gMusic.wsf(0, 1) Windows Script Host: Character set not supported: gb18030

gMusic.wsf(0, 1) Windows Script Host: Cannot convert text to UNICODE for processing
Floor3 ccwan Posted 2010-11-14 08:32
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Thanks for sharing
Floor4 qinchun36 Posted 2010-11-14 17:48
高级用户 Posts 400 Credits 609
Originally posted by netbenton at 2010-11-14 08:20:
It didn't work for me. The error messages are as follows:


gMusic.wsf(0, 1) Windows Script Host: Character set not supported : gb18030

gMusic.wsf(0, 1) Windows Script Host: Cannot convert text to UNICODE for processing

What kind of computer do you have that doesn't support this encoding...
Then you can try opening the code with Notepad, change gb18030 in the first line to gb2312, this should be supported, save it in ANSI format;
Or delete encoding="gb18030" and save it in UNICODE format, it should work.
Floor5 523066680 Posted 2010-11-14 19:43
银牌会员 Posts 1,133 Credits 2,362
The broken computer has no speaker... But this post needs to be topped!
Floor6 netbenton Posted 2010-11-15 04:41
银牌会员 Posts 752 Credits 1,916 From 广西
Changed gb18030 to gb2312,
Really can put it, good yeah~~~~
Need to study it well~~
Thank the LZ for sharing~~
Floor7 radem Posted 2010-11-20 15:02
高级用户 Posts 383 Credits 691
Floor8 nakay1 Posted 2010-11-21 13:54
初级用户 Posts 22 Credits 34
We need to study it carefully.
Floor9 chy505908440 Posted 2010-11-21 14:49
初级用户 Posts 74 Credits 120 From 河北
This must be kept!
Floor10 zaixinxiangnian Posted 2010-11-21 18:52
初级用户 Posts 106 Credits 151 From 河南省
This doesn't seem to run under CMD... Here it calls PLAYER to play it.
Floor11 kingjyb Posted 2010-11-24 16:43
新手上路 Posts 1 Credits 1
Got it!
Floor12 netbenton Posted 2010-12-07 07:21
银牌会员 Posts 752 Credits 1,916 From 广西
After looking at the commented source code, I finally understand something.

There are many things worth learning.
Floor13 bibo35 Posted 2010-12-07 15:56
新手上路 Posts 1 Credits 1
Still need player support
Floor14 lqs623 Posted 2010-12-07 22:32
贫困用户 Posts 30 Credits -3
Received!!!
Floor15 qinchun36 Posted 2010-12-08 10:48
高级用户 Posts 400 Credits 609
Originally posted by lqs623 at 2010-12-7 22:32:
Got it!!!!!

There are actually poor people coming to support! Did you delete your posts until you were poor?
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023