Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bleezr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hector Blondel
Bleezr
Commits
a296cb6e
Commit
a296cb6e
authored
2 years ago
by
Hector Blondel
Browse files
Options
Downloads
Patches
Plain Diff
ajout des fichiers cpp
parent
92f019cd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/bleezr.cpp
+154
-3
154 additions, 3 deletions
client/bleezr.cpp
client/bleezr_installer.cpp
+73
-0
73 additions, 0 deletions
client/bleezr_installer.cpp
with
227 additions
and
3 deletions
client/bleezr.cpp
+
154
−
3
View file @
a296cb6e
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<unistd.h>
#include
<cstring>
using
namespace
std
;
struct
StringList
{
string
content
[
10000
];
int
length
;
}
;
StringList
extract
(
string
);
string
fillstring
(
string
,
char
,
string
);
int
main
(){
cout
<<
"Hello, World !"
;
//cout << "Hello, World !";
//system("pause");
//On récupère le nom de l'utilisateur
system
(
"echo \%username%> username.txt"
);
fstream
fichier
;
fichier
.
open
(
"username.txt"
,
ios
::
in
)
;
string
current_user
;
getline
(
fichier
,
current_user
)
;
cout
<<
current_user
<<
endl
;
fichier
.
close
();
fichier
.
open
(
"config.json"
,
ios
::
in
)
;
string
charplaylists
;
getline
(
fichier
,
charplaylists
)
;
fichier
.
close
();
StringList
listplaylists
=
extract
(
charplaylists
);
string
playlist
=
listplaylists
.
content
[
0
];
cout
<<
"downloading of playlist "
<<
playlist
<<
endl
;
cout
<<
playlist
<<
endl
;
string
commande
=
"curl http://83.114.131.177/bleezr/musics/"
;
commande
.
append
(
playlist
);
commande
.
append
(
"/seen_names.json -o to_download.json"
);
int
n
=
sizeof
(
commande
)
;
char
charcommand
[
n
]
;
strcpy
(
charcommand
,
commande
.
c_str
());
cout
<<
"la commande exécutée est : "
<<
charcommand
<<
endl
;
system
(
charcommand
);
fichier
.
open
(
"to_download.json"
,
ios
::
in
)
;
string
charmusics
;
getline
(
fichier
,
charmusics
)
;
fichier
.
close
();
cout
<<
"le fichier seen_names a été ouvert"
<<
endl
;
cout
<<
"charmusics = "
<<
charmusics
<<
endl
;
StringList
arraymusics
=
extract
(
charmusics
);
int
n
=
arraymusics
.
length
;
cout
<<
"le table est de longueur : "
<<
n
<<
endl
;
for
(
int
i
=
0
;
i
<
n
;
i
++
){
string
commande
=
"curl http://83.114.131.177/bleezr/musics/"
;
commande
.
append
(
playlist
);
commande
.
append
(
"/contents/"
);
commande
.
append
(
fillstring
(
arraymusics
.
content
[
i
],
' '
,
"%20"
));
commande
.
append
(
".mp3 -o
\"
C:/Users/"
);
commande
.
append
(
current_user
);
commande
.
append
(
"/Music/"
);
commande
.
append
(
playlist
);
commande
.
append
(
"/"
);
commande
.
append
(
arraymusics
.
content
[
i
]);
commande
.
append
(
".mp3
\"
"
);
int
n
=
sizeof
(
commande
)
;
char
charcommand
[
n
]
;
strcpy
(
charcommand
,
commande
.
c_str
());
cout
<<
"la commande exécutée est : "
<<
charcommand
<<
endl
;
system
(
charcommand
);
}
cout
<<
"fin du programme"
<<
endl
;
system
(
"pause"
);
return
0
;
}
StringList
extract
(
string
s
){
int
n
=
s
.
length
();
char
charinput
[
n
];
strcpy
(
charinput
,
s
.
c_str
());
string
charres
[
10000
]
;
int
cpt
=
0
;
int
i
=
0
;
while
(
i
<
n
){
if
(
charinput
[
i
]
==
'\"'
){
string
stringadd
=
""
;
i
++
;
int
j
=
0
;
while
(
charinput
[
i
]
!=
'\"'
&&
i
<
n
){
string
new_caracter
(
1
,
charinput
[
i
]);
stringadd
.
append
(
new_caracter
);
i
++
;
j
++
;
};
if
(
i
<
n
){
charres
[
cpt
]
=
stringadd
;
cpt
++
;
};
};
i
++
;
};
StringList
res
;
res
.
length
=
cpt
;
for
(
int
i
=
0
;
i
<
cpt
;
i
++
){
res
.
content
[
i
]
=
charres
[
i
];
};
return
res
;
};
string
fillstring
(
string
input_string
,
char
caract
,
string
chn_to_put
){
int
n
=
input_string
.
length
();
string
res
=
""
;
for
(
int
i
=
0
;
i
<
n
;
i
++
){
if
(
input_string
[
i
]
==
caract
){
cout
<<
"if"
<<
endl
;
res
.
append
(
chn_to_put
);
}
else
{
char
ch
=
input_string
[
i
];
string
chstring
(
1
,
ch
);
res
.
append
(
chstring
);
};
}
return
res
;
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
client/bleezr_installer.cpp
0 → 100644
+
73
−
0
View file @
a296cb6e
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<unistd.h>
#include
<cstring>
using
namespace
std
;
int
main
(){
string
entree
;
cout
<<
"Veuillez saisir le lien complet de votre playlist : "
;
//format https://www.youtube.com/playlist?list=PL8V2Ld0Is1-kWGtqHFOJiwwnU1lWbpC1r par exemple
cin
>>
entree
;
string
code
=
entree
.
substr
(
38
)
;
cout
<<
code
<<
endl
;
system
(
"echo \%username%> username.txt"
);
fstream
fichier
;
fichier
.
open
(
"username.txt"
,
ios
::
in
)
;
string
current_user
;
getline
(
fichier
,
current_user
)
;
cout
<<
current_user
<<
endl
;
fichier
.
close
();
string
commande
=
"curl http://83.114.131.177/bleezr/client/bleezr.exe -o "
;
commande
.
append
(
"
\"
C:/Users/"
)
;
commande
.
append
(
current_user
)
;
commande
.
append
(
"/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/bleezr.exe
\"
"
)
;
int
n
=
sizeof
(
commande
)
;
char
charcommand
[
n
]
;
strcpy
(
charcommand
,
commande
.
c_str
());
system
(
charcommand
);
string
commande2
=
"echo [
\"
"
;
commande2
.
append
(
code
);
commande2
.
append
(
"
\"
]>"
);
commande2
.
append
(
"
\"
C:/Users/"
)
;
commande2
.
append
(
current_user
)
;
commande2
.
append
(
"/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/config.json
\"
"
)
;
int
n2
=
sizeof
(
commande2
)
;
char
charcommand2
[
n2
]
;
strcpy
(
charcommand2
,
commande2
.
c_str
());
cout
<<
"commande 2 : "
<<
charcommand2
<<
endl
;
system
(
charcommand2
);
/*
cout << charcommand <<endl ;
char temp[256] ;
getcwd(temp, 256);
cout << temp << endl ;
*/
//tant que Users n'est pas le dossier courant on va remonter dans l'arborescence. A mettre potentiellement avant l'appel à curl.
system
(
"pause"
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment