2016-02-12 54 views
0

因此,我想將手機中的所有歌曲導出到我的PC中,這些歌曲位於預安裝的音樂播放器中的特定播放列表中。一個應該被整合到imho的功能。但事實並非如此,因爲音樂文件存儲在許多不同的目錄中,有些甚至在外部SD卡上,我不想親自去做。如何將播放列表中的歌曲從Android導出到Windows PC中

谷歌搜索沒有返回任何有價值的和三星凱斯似乎並沒有提供該功能,所以我寫了一個批處理文件,並認爲我可以分享。我這樣做是因爲使用我的文件的人應該對他們將要做什麼有基本的瞭解,當他們是用戶的計算器時他們可能會有什麼。

回答

0

對於此解決方案,您需要安裝adb

如何使用我的文件:

1.創建音樂

This app會自動完成,也將允許導入播放列表(沒有音樂文件)的路徑的文件。但您也可以通過其他方式創建該文件,例如用手。確保每個文件路徑位於新行。空間是好的。

/storage/extSdCard/Instalok/Media__t4p3f3.mp3 /storage/extSdCard/Instalok/Media__t6p5f3.mp3 /storage/extSdCard/Instalok/Media__t8p7f3.mp3 /存儲/模擬/ 0 /書籍/ GRETE_PAIA_San_Sebastiano。 MP3 /存儲/模擬/ 0/MP3 /神童 - 3 kilos.m4a /storage/emulated/0/mp3/Mermaid.mp3

實施例的文件的上方。 調用該文件playlist.txt並將其存儲在我的批處理文件旁邊的PC上。

2.確保您的手機已準備就緒

Android手機通過USB與Windows計算機連接,並打開一個CMD。您可能需要在手機上啓用USB調試或解鎖鎖屏並允許訪問。如果您的手機已連接,則adb devices將列出。

3.檢查文件路徑

如果您自動生成的文件,路徑可能是不一樣的adb用途。在我的情況下,adb使用/mnt/sdcard,而文件包含內部sdcard的所有路徑爲/storage/emulated/0/storage/emulated/通過adb存在,但目錄0沒有。 在我的情況下,它適用於外部SD卡。 因此,通過使用adb shell和你平時瀏覽的方式查看您的路徑:cdls

如果你的路徑比一個亞行需要不同,在文本文件取代它,或利用SEARCHTEXT REPLACETEXT選項的批處理文件。如果你不需要我的選擇,請確保用自己的東西替換。

4.設置你的目標文件夾 編輯批處理文件,並設置pathname您想要的目標文件夾。確保它已經存在!

5. Testrun 將批處理文件存儲在與playlist.txt相同的目錄中並運行它。它會要求你做一個testrun。按y然後按Enter讓它顯示它將使用的源路徑。它也會檢查目標文件夾是否存在:如果它不寫,它將變成紅色。 雖然它不檢查源路徑,那是你自己的工作。

6.運行 再次運行它,這次鍵入除y之外的任何內容。然後按回車。這次它會真正運行,將指定的文件複製到目標文件夾中。

文件

保存爲something.bat

@echo off 
REM make sure everything is set correctly 
REM playlist.txt: place a text file in the same dir as this file 
REM    and name it playlist.txt 
REM    it should contain all file paths on the phone 
REM    each path on a new line 
REM     This can be autogenerated for a playlist by https://play.google.com/store/apps/details?id=org.ssi.playlistbackup 
REM pathname: Where should all the files be saved to 
REM SEARCHTEXT: Where the file containing all the paths says the file is 
REM REPLACETEXT: Where adb shell says the file is 
REM Make sure your destination folder at pathname already exists 
setlocal enabledelayedexpansion 
color 0f 
set pathname=F:\Files\Music 
set SEARCHTEXT=/storage/emulated/0/ 
set REPLACETEXT=/mnt/sdcard/ 
set /p testrun=Is this a testrun? Testrun recommended. (y/n) 
if %testrun%==y (

echo Testrun 

for /F "tokens=*" %%A in (playlist.txt) do (
    set filename=%%~nxA 
    set remotename=%%A 
    REM replace the path with the path as adb uses it. 
    REM use "adb shell 
    REM  >> ls and >>cd 
    REM " to find it out 
    SET string=!remotename! 
    set fixedremotepath=!string:%SEARCHTEXT%=%REPLACETEXT%! 

echo I will try to load this from !fixedremotepath! to !pathname!/!filename! 
) 

echo This warning always appears in Testruns: Make sure you have set all variables as specified in the comments in this file. 
echo If the writing turns red, check your destination Path 
echo I don't check the origin paths for correctness. If they are wrong, they will be mentioned as not found. 
color 0c 
cd %pathname% 

) else (
for /F "tokens=*" %%A in (playlist.txt) do (
    set filename=%%~nxA 
    set remotename=%%A 
    REM replace the path with the path as adb uses it. 
    REM use "adb shell 
    REM  >> ls and >>cd 
    REM " to find it out 
    set SEARCHTEXT=/storage/emulated/0/ 
    set REPLACETEXT=/mnt/sdcard/ 
    SET string=!remotename! 
    set fixedremotepath=!string:%SEARCHTEXT%=%REPLACETEXT%! 

echo I WILL load this from !fixedremotepath! to !pathname!/!filename! 
REM ------------------------------------------------------------ 
adb pull -p "!fixedremotepath!" "!pathname!" 
REM ------------------------------------------------------------ 
) 
) 
pause 
相關問題