Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d4394317d | ||
|
|
8dc5ef2ffa | ||
|
|
8ffbca0daf |
No files matched your search
+1
-1
@@ -58,7 +58,7 @@
|
||||
|
||||
char dl_shared[] = "DL";
|
||||
|
||||
#define URL_SPEED_TEST "http://speedtest.tele2.net/100MB.zip"
|
||||
#define URL_SPEED_TEST "http://kolibrios.org/speedtest/100MB.zip"
|
||||
|
||||
enum {
|
||||
BTN_EXIT=1,
|
||||
|
||||
+49
-32
@@ -32,6 +32,7 @@ char proxy_address[256];
|
||||
#include "settings.h"
|
||||
|
||||
char* active_status;
|
||||
char* save_path_set = false;
|
||||
|
||||
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,
|
||||
0x10000000, sizeof(uEdit)-2, #uEdit, 0, ed_focus + ed_always_focus, 19, 19};
|
||||
@@ -41,6 +42,8 @@ progress_bar pb = {0, GAPX, 52, WIN_W - GAPX - GAPX, 17, 0, NULL, NULL,
|
||||
|
||||
void main()
|
||||
{
|
||||
dword save_path_separator_pos;
|
||||
dword path_pointer;
|
||||
// dword shared_url; // only used by the disabled -mem branch (long URL via SHM)
|
||||
|
||||
load_dll(libini, #lib_init,1);
|
||||
@@ -56,14 +59,21 @@ void main()
|
||||
InitDownload();
|
||||
|
||||
if (param) {
|
||||
path_pointer = #param;
|
||||
//save path specified? Example: https://example.com/file|/sys/media/ac97snd
|
||||
if (save_path_separator_pos = strchr(#param, '|')) {
|
||||
save_path_set = true;
|
||||
strcpy(#filepath, save_path_separator_pos+1);
|
||||
ESBYTE[save_path_separator_pos] = '\0';
|
||||
}
|
||||
if (streqrp(#param, "-e ")) {
|
||||
autoclose.checked = true;
|
||||
param += 3;
|
||||
path_pointer += 3;
|
||||
}
|
||||
if (streqrp(#param, "-eo ")) {
|
||||
autoclose.checked = true;
|
||||
open_file = true;
|
||||
param += 4;
|
||||
path_pointer += 4;
|
||||
}
|
||||
|
||||
// Disabled long-URL-via-SHM ("DL") channel. memopen was never
|
||||
@@ -73,12 +83,13 @@ void main()
|
||||
// shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
|
||||
// strcpy(#uEdit, shared_url);
|
||||
// } else {
|
||||
strcpy(#uEdit, #param);
|
||||
// }
|
||||
|
||||
if (streq(#param, "-test")) {
|
||||
strcpy(#uEdit, URL_SPEED_TEST);
|
||||
} else {
|
||||
strcpy(#uEdit, path_pointer);
|
||||
debugln(path_pointer);
|
||||
}
|
||||
// }
|
||||
}
|
||||
if (uEdit[0]) StartDownloading(); else {
|
||||
edit_box_set_text stdcall (#ed, "http://");
|
||||
@@ -172,7 +183,11 @@ void DrawWindow()
|
||||
DrawBar(GAPX, WIN_H - 58, WIN_W - GAPX - GAPX, 1, sc.light);
|
||||
DrawBar(GAPX, WIN_H - 58 + 1, WIN_W - GAPX - GAPX, 1, sc.dark);
|
||||
WriteText(GAPX, WIN_H - 48, 0x90, sc.work_text, T_SAVE_TO);
|
||||
WriteTextWithBg(GAPX + 108, WIN_H - 48, 0xD0, sc.work_text, #save_dir, sc.light);
|
||||
if (save_path_set) {
|
||||
WriteTextWithBg(GAPX + 108, WIN_H - 48, 0xD0, sc.work_text, #filepath, sc.light);
|
||||
} else {
|
||||
WriteTextWithBg(GAPX + 108, WIN_H - 48, 0xD0, sc.work_text, #save_dir, sc.light);
|
||||
}
|
||||
edit_box_draw stdcall (#ed);
|
||||
progressbar_draw stdcall(#pb);
|
||||
autoclose.draw(GAPX, WIN_H - 24);
|
||||
@@ -305,36 +320,38 @@ void SaveFile(int attempt)
|
||||
char notify_message[4296];
|
||||
char file_name[URL_SIZE+96];
|
||||
|
||||
//if save_path is not set than we have to combine it
|
||||
if (!save_path_set) {
|
||||
strcpy(#filepath, #save_dir);
|
||||
chrcat(#filepath, '/'); ///need to check the last symbol
|
||||
|
||||
strcpy(#filepath, #save_dir);
|
||||
chrcat(#filepath, '/'); ///need to check the last symbol
|
||||
|
||||
if (attempt > 9) {
|
||||
notify("'Too many saving attempts' -E");
|
||||
return;
|
||||
}
|
||||
|
||||
if (attempt > 0) {
|
||||
chrcat(#filepath, attempt+'0');
|
||||
chrcat(#filepath, '_');
|
||||
}
|
||||
|
||||
//Content-Disposition: attachment; filename="RealFootball_2018_Nokia_5800_EN_IGP_EU_TS_101.zip"
|
||||
if (http.header_field("content-disposition", #file_name, sizeof(file_name))) {
|
||||
if (EDX = strstr(#file_name,"filename=\"")) {
|
||||
strcat(#filepath, EDX+10);
|
||||
ESBYTE[strchr(#filepath,'\"')] = '\0';
|
||||
if (attempt > 9) {
|
||||
notify("'Too many saving attempts' -E");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Clean all slashes at the end
|
||||
strcpy(#file_name, #uEdit);
|
||||
while (file_name[strlen(#file_name)-1] == '/') {
|
||||
file_name[strlen(#file_name)-1] = 0;
|
||||
|
||||
if (attempt > 0) {
|
||||
chrcat(#filepath, attempt+'0');
|
||||
chrcat(#filepath, '_');
|
||||
}
|
||||
strcat(#filepath, #file_name+strrchr(#file_name, '/'));
|
||||
|
||||
//Content-Disposition: attachment; filename="RealFootball_2018_Nokia_5800_EN_IGP_EU_TS_101.zip"
|
||||
if (http.header_field("content-disposition", #file_name, sizeof(file_name))) {
|
||||
if (EDX = strstr(#file_name,"filename=\"")) {
|
||||
strcat(#filepath, EDX+10);
|
||||
ESBYTE[strchr(#filepath,'\"')] = '\0';
|
||||
}
|
||||
} else {
|
||||
// Clean all slashes at the end
|
||||
strcpy(#file_name, #uEdit);
|
||||
while (file_name[strlen(#file_name)-1] == '/') {
|
||||
file_name[strlen(#file_name)-1] = 0;
|
||||
}
|
||||
strcat(#filepath, #file_name+strrchr(#file_name, '/'));
|
||||
}
|
||||
|
||||
for (i=0; i<strlen(#filepath); i++) if(filepath[i]==':')||(filepath[i]=='?')filepath[i]='-';
|
||||
}
|
||||
|
||||
for (i=0; i<strlen(#filepath); i++) if(filepath[i]==':')||(filepath[i]=='?')filepath[i]='-';
|
||||
|
||||
while (file_exists(#filepath)) {
|
||||
SaveFile(attempt+1);
|
||||
|
||||
+9
-1
@@ -11,6 +11,7 @@
|
||||
#include "../lib/gui.h"
|
||||
#include "../lib/random.h"
|
||||
#include "../lib/kfont.h"
|
||||
#include "../lib/fs.h"
|
||||
|
||||
#include "../lib/obj/libimg.h"
|
||||
#include "../lib/obj/libini.h"
|
||||
@@ -415,6 +416,7 @@ void EventStopPlaying()
|
||||
void EventStartPlaying()
|
||||
{
|
||||
word i;
|
||||
BDVK CopyFile_atr;
|
||||
char item_path[4096];
|
||||
char notify_message[512];
|
||||
EventStopPlaying();
|
||||
@@ -433,7 +435,13 @@ void EventStartPlaying()
|
||||
DrawPlayList();
|
||||
DrawTopPanel();
|
||||
//start_playing_time =
|
||||
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||
if (player_run_id < 0) {
|
||||
RunProgram("/sys/network/dl", "-e http://builds.kolibrios.org/en_US/data/programs/media/ac97snd/ac97snd.bin|/sys/media/ac97snd");
|
||||
pause(100);
|
||||
player_run_id = RunProgram("/sys/media/ac97snd", #item_path);
|
||||
if (player_run_id < 0) notify("'AC97SND backend not found and its download failed :('-E");
|
||||
}
|
||||
//player_run_id = RunProgram("/kolibrios/media/minimp3", #item_path);
|
||||
sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename);
|
||||
if (!repeat) && (window_mode==WINDOW_MODE_SMALL)
|
||||
|
||||
Reference in new issue
Block a user