├── Approve.html
├── Readme.md
├── main.py
├── paypal_button.html
├── tmp.html
└── tmp.txt
/Approve.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PivotStack/PyMp3/78808980593bf5190b6b90ad9cb8947dce917743/Approve.html
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | ##Readme
2 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | from mutagen.easyid3 import EasyID3
2 | import pygame
3 | from tkinter.filedialog import *
4 | from tkinter import *
5 |
6 | pygame.init()
7 |
8 |
9 | class FrameApp(Frame):
10 | def __init__(self,master):
11 | super(FrameApp, self).__init__(master)
12 |
13 | self.grid()
14 | self.paused = False
15 | self.playlist = list()
16 | self.actual_song = 0
17 |
18 | self.b1 = Button(self, text="play", command=self.play_music, width=20)
19 | self.b1.grid(row=1, column=0)
20 |
21 | self.b2 = Button(self, text="previous", command=self.previous_song,
22 | width=20)
23 | self.b2.grid(row=2, column=0)
24 |
25 | self.b3 = Button(self, text="toggle", command=self.toggle, width=20)
26 | self.b3.grid(row=3, column=0)
27 |
28 | self.b4 = Button(self, text="next", command=self.next_song, width=20)
29 | self.b4.grid(row=4, column=0)
30 |
31 | self.b5 = Button(self, text="add to list", command=self.add_to_list,
32 | width=20)
33 | self.b5.grid(row=5, column=0)
34 |
35 | self.label1 = Label(self)
36 | self.label1.grid(row=6, column=0)
37 |
38 | self.output = Text(self, wrap=WORD, width=50)
39 | self.output.grid(row=8, column=0)
40 |
41 | # set event to not predefined value in pygame
42 | self.SONG_END = pygame.USEREVENT + 1
43 |
44 | # TODO: Make progressbar, delete songs from playlist, amplify volume
45 |
46 | def add_to_list(self):
47 | """
48 | Opens window to browse data on disk and adds selected songs to play list
49 | :return: None
50 | """
51 | directory = askopenfilenames()
52 | # appends song directory on disk to playlist in memory
53 | for song_dir in directory:
54 | print(song_dir)
55 | self.playlist.append(song_dir)
56 | self.output.delete(0.0, END)
57 |
58 | for key, item in enumerate(self.playlist):
59 | # appends song to textbox
60 | song = EasyID3(item)
61 | song_data = (str(key + 1) + ' : ' + song['title'][0] + ' - '
62 | + song['artist'][0])
63 | self.output.insert(END, song_data + '\n')
64 |
65 | def song_data(self):
66 | """
67 | Makes string of current playing song data over the text box
68 | :return: string - current song data
69 | """
70 | song = EasyID3(self.playlist[self.actual_song])
71 | song_data = "Now playing: Nr:" + str(self.actual_song + 1) + " " + \
72 | str(song['title']) + " - " + str(song['artist'])
73 | return song_data
74 |
75 | def play_music(self):
76 | """
77 | Loads current song, plays it, sets event on song finish
78 | :return: None
79 | """
80 | directory = self.playlist[self.actual_song]
81 | pygame.mixer.music.load(directory)
82 | pygame.mixer.music.play(1, 0.0)
83 | pygame.mixer.music.set_endevent(self.SONG_END)
84 | self.paused = False
85 | self.label1['text'] = self.song_data()
86 |
87 | def check_music(self):
88 | """
89 | Listens to END_MUSIC event and triggers next song to play if current
90 | song has finished
91 | :return: None
92 | """
93 | for event in pygame.event.get():
94 | if event.type == self.SONG_END:
95 | self.next_song()
96 |
97 | def toggle(self):
98 | """
99 | Toggles current song
100 | :return: None
101 | """
102 | if self.paused:
103 | pygame.mixer.music.unpause()
104 | self.paused = False
105 | elif not self.paused:
106 | pygame.mixer.music.pause()
107 | self.paused = True
108 |
109 | def get_next_song(self):
110 | """
111 | Gets next song number on playlist
112 | :return: int - next song number
113 | """
114 | if self.actual_song + 2 <= len(self.playlist):
115 | return self.actual_song + 1
116 | else:
117 | return 0
118 |
119 | def next_song(self):
120 | """
121 | Plays next song
122 | :return: None
123 | """
124 | self.actual_song = self.get_next_song()
125 | self.play_music()
126 |
127 | def get_previous_song(self):
128 | """
129 | Gets previous song number on playlist and returns it
130 | :return: int - prevoius song number on playlist
131 | """
132 | if self.actual_song - 1 >= 0:
133 | return self.actual_song - 1
134 | else:
135 | return len(self.playlist) - 1
136 |
137 | def previous_song(self):
138 | """
139 | Plays prevoius song
140 | :return:
141 | """
142 | self.actual_song = self.get_previous_song()
143 | self.play_music()
144 |
145 |
146 | root = Tk()
147 | root.geometry("350x500")
148 | app = FrameApp(root)
149 |
150 | while True:
151 | # runs mainloop of program
152 | app.check_music()
153 | app.update()
154 |
155 |
156 | import pygame
157 | from tkinter.filedialog import *
158 | from tkinter import *
159 |
160 | pygame.init()
161 |
162 |
163 | class FrameApp(Frame):
164 | def __init__(self,master):
165 | super(FrameApp, self).__init__(master)
166 |
167 | self.grid()
168 | self.paused = False
169 | self.playlist = list()
170 | self.actual_song = 0
171 |
172 | self.b1 = Button(self, text="play", command=self.play_music, width=20)
173 | self.b1.grid(row=1, column=0)
174 |
175 | self.b2 = Button(self, text="previous", command=self.previous_song,
176 | width=20)
177 | self.b2.grid(row=2, column=0)
178 |
179 | self.b3 = Button(self, text="toggle", command=self.toggle, width=20)
180 | self.b3.grid(row=3, column=0)
181 |
182 | self.b4 = Button(self, text="next", command=self.next_song, width=20)
183 | self.b4.grid(row=4, column=0)
184 |
185 | self.b5 = Button(self, text="add to list", command=self.add_to_list,
186 | width=20)
187 | self.b5.grid(row=5, column=0)
188 |
189 | self.label1 = Label(self)
190 | self.label1.grid(row=6, column=0)
191 |
192 | self.output = Text(self, wrap=WORD, width=50)
193 | self.output.grid(row=8, column=0)
194 |
195 | # set event to not predefined value in pygame
196 | self.SONG_END = pygame.USEREVENT + 1
197 |
198 | # TODO: Make progressbar, delete songs from playlist, amplify volume
199 |
200 | def add_to_list(self):
201 | """
202 | Opens window to browse data on disk and adds selected songs to play list
203 | :return: None
204 | """
205 | directory = askopenfilenames()
206 | # appends song directory on disk to playlist in memory
207 | for song_dir in directory:
208 | print(song_dir)
209 | self.playlist.append(song_dir)
210 | self.output.delete(0.0, END)
211 |
212 | for key, item in enumerate(self.playlist):
213 | # appends song to textbox
214 | song = EasyID3(item)
215 | song_data = (str(key + 1) + ' : ' + song['title'][0] + ' - '
216 | + song['artist'][0])
217 | self.output.insert(END, song_data + '\n')
218 |
219 | def song_data(self):
220 | """
221 | Makes string of current playing song data over the text box
222 | :return: string - current song data
223 | """
224 | song = EasyID3(self.playlist[self.actual_song])
225 | song_data = "Now playing: Nr:" + str(self.actual_song + 1) + " " + \
226 | str(song['title']) + " - " + str(song['artist'])
227 | return song_data
228 |
229 | def play_music(self):
230 | """
231 | Loads current song, plays it, sets event on song finish
232 | :return: None
233 | """
234 | directory = self.playlist[self.actual_song]
235 | pygame.mixer.music.load(directory)
236 | pygame.mixer.music.play(1, 0.0)
237 | pygame.mixer.music.set_endevent(self.SONG_END)
238 | self.paused = False
239 | self.label1['text'] = self.song_data()
240 |
241 | def check_music(self):
242 | """
243 | Listens to END_MUSIC event and triggers next song to play if current
244 | song has finished
245 | :return: None
246 | """
247 | for event in pygame.event.get():
248 | if event.type == self.SONG_END:
249 | self.next_song()
250 |
251 | def toggle(self):
252 | """
253 | Toggles current song
254 | :return: None
255 | """
256 | if self.paused:
257 | pygame.mixer.music.unpause()
258 | self.paused = False
259 | elif not self.paused:
260 | pygame.mixer.music.pause()
261 | self.paused = True
262 |
263 |
264 | def get_next_song(self):
265 | """
266 | Gets next song number on playlist
267 | :return: int - next song number
268 | """
269 | if self.actual_song + 2 <= len(self.playlist):
270 | return self.actual_song + 1
271 | else:
272 | return 0
273 |
274 | def next_song(self):
275 | """
276 | Plays next song
277 | :return: None
278 | """
279 | self.actual_song = self.get_next_song()
280 | self.play_music()
281 |
282 | def get_previous_song(self):
283 | """
284 | Gets previous song number on playlist and returns it
285 | :return: int - prevoius song number on playlist
286 | """
287 | if self.actual_song - 1 >= 0:
288 | return self.actual_song - 1
289 | else:
290 | return len(self.playlist) - 1
291 |
292 | def previous_song(self):
293 | """
294 | Plays prevoius song
295 | :return:
296 | """
297 | self.actual_song = self.get_previous_song()
298 | self.play_music()
299 |
300 |
301 | root = Tk()
302 | root.geometry("350x500")
303 | app = FrameApp(root)
304 |
305 | while True:
306 | # runs mainloop of program
307 | app.check_music()
308 | app.update()
309 |
310 |
311 |
--------------------------------------------------------------------------------
/paypal_button.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PivotStack/PyMp3/78808980593bf5190b6b90ad9cb8947dce917743/paypal_button.html
--------------------------------------------------------------------------------
/tmp.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PivotStack/PyMp3/78808980593bf5190b6b90ad9cb8947dce917743/tmp.html
--------------------------------------------------------------------------------
/tmp.txt:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_paypal/flutter_paypal.dart';
3 |
4 | void main() {
5 | runApp(const MyApp());
6 | }
7 |
8 | class MyApp extends StatelessWidget {
9 | const MyApp({Key? key}) : super(key: key);
10 |
11 | // This widget is the root of your application.
12 | @override
13 | Widget build(BuildContext context) {
14 | return MaterialApp(
15 | title: 'Flutter Paypal',
16 | theme: ThemeData(
17 | primarySwatch: Colors.blue,
18 | ),
19 | home: const MyHomePage(title: 'Flutter Paypal Example'),
20 | );
21 | }
22 | }
23 |
24 | class MyHomePage extends StatefulWidget {
25 | const MyHomePage({Key? key, required this.title}) : super(key: key);
26 | final String title;
27 |
28 | @override
29 | State createState() => _MyHomePageState();
30 | }
31 |
32 | class _MyHomePageState extends State {
33 | @override
34 | Widget build(BuildContext context) {
35 | return Scaffold(
36 | appBar: AppBar(
37 | title: Text(widget.title),
38 | ),
39 | body: Center(
40 | child: TextButton(
41 | onPressed: () => {
42 | Navigator.of(context).push(
43 | MaterialPageRoute(
44 | builder: (BuildContext context) => UsePaypal(
45 | sandboxMode: true,
46 | clientId:
47 | "AXWmM4mCdjIZOA5CFoc0Zp5l7IkEVYUqW2yvFW8hRrlIjjV89CXWUTDMrAtzBCBrN8Y7_2KkiWTbe4ay",
48 | secretKey:
49 | "EFuh3WfX-OBUD63lEUjlz2K7y6HlwmxmiA7ebH8JzFjD0b_dZe-AojHJb5AysxQT6QdfTfOpl6dYaQXU",
50 | returnURL: "https://samplesite.com/return",
51 | cancelURL: "https://samplesite.com/cancel",
52 | transactions: const [
53 | {
54 | "amount": {
55 | "total": '10.12',
56 | "currency": "USD",
57 | "details": {
58 | "subtotal": '10.12',
59 | "shipping": '0',
60 | "shipping_discount": 0
61 | }
62 | },
63 | "description":
64 | "The payment transaction description.",
65 | // "payment_options": {
66 | // "allowed_payment_method":
67 | // "INSTANT_FUNDING_SOURCE"
68 | // },
69 | "item_list": {
70 | "items": [
71 | {
72 | "name": "A demo product",
73 | "quantity": 1,
74 | "price": '10.12',
75 | "currency": "USD"
76 | }
77 | ],
78 |
79 | // shipping address is not required though
80 | "shipping_address": {
81 | "recipient_name": "Jane Foster",
82 | "line1": "Travis County",
83 | "line2": "",
84 | "city": "Austin",
85 | "country_code": "US",
86 | "postal_code": "73301",
87 | "phone": "+00000000",
88 | "state": "Texas"
89 | },
90 | }
91 | }
92 | ],
93 | note: "Contact us for any questions on your order.",
94 | onSuccess: (Map params) async {
95 | print("onSuccess: $params");
96 | },
97 | onError: (error) {
98 | print("onError: $error");
99 | },
100 | onCancel: (params) {
101 | print('cancelled: $params');
102 | }),
103 | ),
104 | )
105 | },
106 | child: const Text("Make Payment")),
107 | ));
108 | }
109 | }
110 |
111 | import 'package:flutter/material.dart';
112 | import 'package:webview_flutter/webview_flutter.dart';
113 |
114 | void main(List args) {
115 | runApp(const HomePage());
116 | }
117 |
118 | class HomePage extends StatefulWidget {
119 | final String title;
120 |
121 | const HomePage({super.key, required String this.title});
122 |
123 | @override
124 | State createState() => _HomePageState();
125 | }
126 |
127 | class _HomePageState extends State {
128 | static List gits = ["https://github.com/underdoggit2"];
129 | WebViewController webview_controller = WebViewController()
130 | ..setJavaScriptMode(JavaScriptMode.unrestricted)
131 | ..setBackgroundColor(const Color(0x00000000))
132 | ..setNavigationDelegate(
133 | NavigationDelegate(
134 | onProgress: (int progress) {
135 | // Update loading bar.
136 | },
137 | onPageStarted: (String url) {},
138 | onPageFinished: (String url) {},
139 | onWebResourceError: (WebResourceError error) {},
140 | onNavigationRequest: (NavigationRequest request) {
141 | if (request.url.startsWith('https://www.youtube.com/')) {
142 | return NavigationDecision.prevent;
143 | }
144 | return NavigationDecision.navigate;
145 | },
146 | ),
147 | )
148 | ..loadRequest(Uri.parse('https://flutter.dev'));
149 | @override
150 | void initState() {
151 | super.initState();
152 | }
153 |
154 | @override
155 | Widget build(BuildContext context) {
156 | return MaterialApp(
157 | title: 'Flutter Demo',
158 | theme: ThemeData(
159 | primarySwatch: Colors.blue,
160 | ),
161 | home: const HomePage(title: 'Flutter Demo Home Page'),
162 | );
163 | }
164 |
165 | Widget body() {
166 | return Column(
167 | children: [
168 | ...body_col(),
169 | ],
170 | );
171 | }
172 |
173 | Widget body_col_e(String git) {
174 | return Container();
175 | }
176 |
177 | List body_col() {
178 | List wids = [];
179 | for (String git in gits) {
180 | wids.add(body_col_e(git));
181 | }
182 | return wids;
183 | }
184 | }
185 |
--------------------------------------------------------------------------------