Raspberry Pi + Rune Audio ::: Một trải nghiệm nghe nhạc mới

tml3nr

Moderator
Add-on này, theo em đọc code, không đụng gì đến kernel đâu, bác khỏi lo xa.

Có phần pacman -Sy nhưng là option, còn lại đều vô hại.

Mã:
#!/bin/bash
# main reference
alias=RuneYoutube
### template - import default variables, functions
. /srv/http/addonstitle.sh
### template - function: start message, installed check
installstart $@
### template - function: get repository zip and extract to system directories
getinstallzip
### template - function: (optional) rank miror servers and 'pacman -Sy' before install packages
rankmirrors
command -v ffmpeg >/dev/null 2>&1 || { echo -e "$warn ERROR: ffmpeg is not installed, please run the MPC Upgrade first." >&2; exit 1; }
gitpath=https://github.com/xortuna/RuneYoutubeAddon/raw/master/
### PACMAN ###
echo -e "$bar Installing youtube-dl and atomicparsley..."
pacman -S --noconfirm youtube-dl atomicparsley
### PHP Script ###
echo -e "$bar Creating web files..."
echo '<?php
try {
set_time_limit(0);
ini_set('max_execution_time', 600);
$u = urldecode($_GET['url']);
#validate
$youtube = "/^(https:\/\/|http:\/\/|)(www\.|m\.|)(youtube\.com\/watch\?v=|youtu\.be\/)[\w-]+$/";
$playlist ="/^(https:\/\/|http:\/\/|)(www\.|m\.|)(youtube\.com\/playlist\?list=|youtu\.be\/)[\w-]+$/";
if ( preg_match ($youtube, $u ) )
{
exec("tube " . $u );
echo "sent song" . $u;
}
if(preg_match($playlist, $u))
{
exec("tubeplaylist " . $u . " >/dev/null 2>&1 &");
echo "sent playlist" . $u;
}
}
catch (Exception $e) {
echo "Exception : ", $e->getMessage(),"<br />";
}
?>' >> /srv/http/youtube.php
## Javascript Injection into Footer##
file=/srv/http/app/templates/footer.php
echo $file
echo '<script src="<?=$this->asset('"'"'/js/RuneYoutube.js'"'"')?>"></script>' >> $file
### Tube ###
echo -e "$bar Creasting bash scripts..."
echo $'#!/bin/bash
youtube-dl --no-mtime --embed-thumbnail --restrict-filenames -o \'/mnt/MPD/LocalStorage/Youtube/%(title)s.%(ext)s\' --write-description -f "bestaudio[ext=m4a]" $1 && mpc update --wait LocalStorage/Youtube && VV=$(ls /mnt/MPD/LocalStorage/Youtube/*.description -t | head -n1) && VV=$(basename $VV .description) && mpc add "LocalStorage/Youtube/$VV.m4a" && echo $VV && chown -R http:http /mnt/MPD/LocalStorage/Youtube/$VV.*' >> /usr/local/bin/tube
### Tube playlist ###
echo $'#!/bin/bash
youtube-dl --no-mtime --embed-thumbnail --restrict-filenames --ignore-errors -o \'/mnt/MPD/LocalStorage/Youtube/%(title)s.%(ext)s\' --write-description -f "bestaudio[ext=m4a]" $1 ; mpc update --wait LocalStorage/Youtube
(IFS=\'
\'
for x in $(find /mnt/MPD/LocalStorage/Youtube/ -type f -name *.description -mmin -15); do VV=$(basename "$x" .description) && mpc add "LocalStorage/Youtube/$VV.m4a" && echo $VV && rm $x; done)
#Find all descriptions less than 15 min modifcation time then add to playlist' >> /usr/local/bin/tubeplaylist
echo -e "$bar Patching files ..."
file=/srv/http/app/templates/playback.php
echo $file
sed -i -e $'/<button id="pl-manage-save" class="btn btn-default" type="button" title="Save current queue as playlist" data-toggle="modal" data-target="#modal-pl-save"><i class="fa fa-save"><\/i><\/button>/ a\
<!-- RUNE_YOUTUBE_MOD -->\
<button id="pl-import-youtube" class="btn btn-default" type="button" title="Import a playlist or video from youtube." data-toggle="modal" data-target="#modal-pl-youtube"><i class="fa fa-youtube-play"></i></button>\
<!-- END_RUNE_YOUTUBE_MOD -->' -e $'/<div id="modal-pl-save" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-pl-save-label" aria-hidden="true">/ i\
<!-- RUNE_YOUTUBE_MOD -->\
<div id="modal-pl-youtube" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-pl-youtube-label" aria-hidden="true">\
<div class="modal-dialog">\
<div class="modal-content">\
<div class="modal-header">\
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
<h3 class="modal-title" id="modal-pl-youtube-label">Import from youtube</h3>\
</div>\
<div class="modal-body">\
<label for="pl-video-url">Enter a video or playlist url</label>\
<input id="pl-video-url" class="form-control osk-trigger" type="text" placeholder="Enter url">\
</div>\
<div class="modal-footer">\
<button type="button" class="btn btn-default btn-lg" data-dismiss="modal">Close</button>\
<button type="button" id="modal-pl-youtube-btn" class="btn btn-primary btn-lg" data-dismiss="modal">Import</button>\
</div>\
</div>\
</div>\
</div>\
<!-- END_RUNE_YOUTUBE_MOD -->' $file
# for RuneUI Enhancement
file=/srv/http/app/templates/playbackcustom.php
[[ -e $file ]] && sed -i '/id="pl-import-youtube"/ {s/<!--//; s/-->//}' $file
echo -e "$bar Creating YouTube storage directory ..."
dir=/mnt/MPD/LocalStorage/Youtube
echo $dir
mkdir $dir
echo -e "$bar Updating file permissions..."
chmod 777 /usr/local/bin/tube
chmod 777 /usr/local/bin/tubeplaylist
chmod 777 /srv/http/youtube.php
chown http:http /srv/http/youtube.php
chown http:http /usr/local/bin/tube
chown http:http /usr/local/bin/tubeplaylist
chown http:http /mnt/MPD/LocalStorage/Youtube
echo -e "$bar Getting album art..."
wgetnc $gitpath/cover.png -P /mnt/MPD/LocalStorage/Youtube
# end custom script --------------------------------------------------------------------------------<<<
### template - function: save version to database, finish message
installfinish $@
clearcache
#Check dependancies
echo -e "$bar #### Check you have expanded root FS or you will only be able to store 10 songs ####"
Cảm ơn anh. Hôm nào rãnh em sẽ thử luôn cho hết tuồng vụ play audio Youtube :cool:
 
Chỉnh sửa lần cuối:

linh0983

Well-Known Member
Hi ! Lại nói về con 520DAC Pro a . Chú này phần Digital và Analog thì ngon nhưng nóng các bác . Do 2 con LME49600 (khuếch đại tai nghe) tỏa nhiệt . Mình thấy họ ship luôn cái case ko dùng được nó kín mít cho dù đục lỗ cũng ko ăn thua . Theo mình các bác độn gấp đôi con bulong cao lên là ok mình đã mở suốt 24 giờ ko vấn đề gì .

IMG_20171128_071525.jpg


Trước khi dùng tai nghe (nếu muốn thử) chỉnh volume sofware khoàng 15% nếu ko muốn thủng màng nhĩ a .
Mình có so sánh cùng 1 bản nhạc (loa ngoài) tiếng leng keng con này nghe rất rõ bay bay ở đâu đâu đấy a khi dùng remote chuyển qua lại giữa các DAC HAT . :p
 

vinh57

Member
Cài có đơn giản ko bác mình thì chậm chạp theo pháp bác @tml3nr vòng vòng chóng cả mặt . :D
Trình buble mình đang dùng điều khiển moode bình thường ,trên dt bạn mở youtube ấn share lần đầu tiên bạn ấn nó sẽ tự động thêm một ứng dụng gì đó hố trợ thêm sau đó bạn trở lại youtube bạn share lại và rất đơn giản
 

tml3nr

Moderator
Cài có đơn giản ko bác mình thì chậm chạp theo pháp bác @tml3nr vòng vòng chóng cả mặt . :D
Cái vụ lấy VLC phát radio hay lắm đó anh. Nói anh đừng cười chứ em mất 3 tuần vật vã mới mò ra tới nó. Riêng cái dòng lệnh #transcode{vcodec=none,acodec=mp3,ab=320... em mất 3 ngày mới mò ra :D

Em đang phát... bolero từ Youtube. Các anh có rãnh add vô nghe thử xem sao ạ. IP hiện tại là
Mã:
http://14.169.108.248:8080/vlc.mp3

vlc_radio.png
 
Chỉnh sửa lần cuối:

tml3nr

Moderator
Trình buble mình đang dùng điều khiển moode bình thường ,trên dt bạn mở youtube ấn share lần đầu tiên bạn ấn nó sẽ tự động thêm một ứng dụng gì đó hố trợ thêm sau đó bạn trở lại youtube bạn share lại và rất đơn giản
Anh chụp vài cái hình cho bọn em xem với ạ?
 

hoangmaianh123

Active Member
Cái vụ lấy VLC phát radio hay lắm đó anh. Nói anh đừng cười chứ em mất 3 tuần vật vã mới mò ra tới nó. Riêng cái dòng lệnh #transcode{vcodec=none,acodec=mp3,ab=320... em mất 3 ngày mới mò ra :D

Em đang phát... bolero từ Youtube. Anh có rãnh add vô nghe thử xem sao ạ. IP hiện tại là


vlc_02.png
[/QUOTE
Dùng VLC phát qua Rune nghe hay,mình cũng đã thử phát Youtube trên Rune nhưng không bằng VLC .
 

vinh57

Member
Anh chụp vài cái hình cho bọn em xem với ạ?
Đơn giản lắm bác ạ , trên đt android bác bubble upnp để điều khiển được moode , nhớ chọn rederer là moode upnpb,sau đó bác vào youtube để share thôi , lần đầu chọn share bubble upnp nó tự động tải và cài thêm cái gì đó mau thôi, sau đó bác vào youtube share đợi tí cho nó load, tai trâu mình nghe ổn
 

hoangmaianh123

Active Member
Cái vụ lấy VLC phát radio hay lắm đó anh. Nói anh đừng cười chứ em mất 3 tuần vật vã mới mò ra tới nó. Riêng cái dòng lệnh #transcode{vcodec=none,acodec=mp3,ab=320... em mất 3 ngày mới mò ra :D

Em đang phát... bolero từ Youtube. Các anh có rãnh add vô nghe thử xem sao ạ. IP hiện tại là


View attachment 276144
Dùng VLC phát qua Rune nghe hay,mình cũng đã thử phát Youtube trên Rune nhưng không bằng VLC .
 

tml3nr

Moderator
Đơn giản lắm bác ạ , trên đt android bác bubble upnp để điều khiển được moode , nhớ chọn rederer là moode upnpb,sau đó bác vào youtube để share thôi , lần đầu chọn share bubble upnp nó tự động tải và cài thêm cái gì đó mau thôi, sau đó bác vào youtube share đợi tí cho nó load, tai trâu mình nghe ổn
Mình đang xài bản free hình như nó chỉ cho share 3 lần một ngày thôi , ai có bản pro thử xem
Dạ em chưa hiểu cái chổ vào youtube để share lắm.

Bản pro anh vào appvn có đó ạ:

http://appvn.com/android/search?keyword=BubbleUPnP
 

vinh57

Member
Vào youtube bác ấn share nó sẽ hiện ra list bác chọn bubble upnp khi đó bubble nó khởi động lần đầu nó sẽ load thêm ứng dụng hỗ trợ, sau đó bác vào lại youtube lập lai như lần trước hễ thấy có vòng tròn là được rồi đấy ,đợi tí chờ no play thôi
 

conquaivat01

New Member
Tư vấn em 6tr có dàn âm thanh dollby được không, e xem netflix nhưng âm thanh tivi chưa đạt chuẩn
----------------------------------




Netflix tìm người dùng chung gói 4K,

>> Netfilix có Vietsub và một số phim lồng tiếng nhé bà con !!! Đang báo đứt cáp mà xem vẫn bình thường, xem rõ mồn một từng sợi lông chân. Xem 50 sắc thái grey kích thích vãi hà



Bạn nào có nhu cầu dùng liên hệ mình,

Hiện mình còn 2 slot.

-->Phí thanh toán : 65k / tháng , hoặc 70k card, hoặc 3$ paypal

Liên hệ mình qua mail nhé : [email protected]

 
Bên trên