summaryrefslogtreecommitdiff
path: root/include/pb_controller.h
blob: 5b1b360ba6626eeea2accc82d09d28302200da76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef PODBEUTER_CONTROLLER__H
#define PODBEUTER_CONTROLLER__H

#include <string>
#include <configcontainer.h>
#include <download.h>
#include <queueloader.h>
#include <vector>

namespace podbeuter {

class pb_view;

class queueloader;

class pb_controller {
	public:
		pb_controller();
		~pb_controller();
		inline void set_view(pb_view * vv) {
			v = vv;
		}
		void run(int argc, char * argv[] = 0);

		inline bool view_update_necessary() const {
			return view_update_;
		}
		inline void set_view_update_necessary(bool b) {
			view_update_ = b;
		}
		std::vector<download>& downloads() {
			return downloads_;
		}

		void usage(const char * argv0);

		std::string get_dlpath();

		unsigned int downloads_in_progress();
		void reload_queue(bool remove_unplayed = false);

		unsigned int get_maxdownloads();
		void start_downloads();

		void increase_parallel_downloads();
		void decrease_parallel_downloads();

		double get_total_kbps();

		void play_file(const std::string& str);

		inline newsbeuter::configcontainer * get_cfgcont() {
			return cfg;
		}

	private:
		bool setup_dirs_xdg(const char *env_home);

		pb_view * v;
		std::string config_file;
		std::string queue_file;
		newsbeuter::configcontainer * cfg;
		bool view_update_;
		std::vector<download> downloads_;

		std::string config_dir;
		std::string url_file;
		std::string cache_file;
		std::string searchfile;
		std::string cmdlinefile;

		unsigned int max_dls;

		queueloader * ql;
};

}

#endif