Browse Source

ftp uploads

Ivars 6 years ago
parent
commit
d9270d39bb
2 changed files with 306 additions and 261 deletions
  1. 263
    247
      project.wpr
  2. 43
    14
      sources/config.py

+ 263
- 247
project.wpr View File

@@ -114,10 +114,18 @@ debug.breakpoints = {loc('Downloader.py'): {182L: (0,
114 114
         None,
115 115
         1,
116 116
         0)},
117
-                     loc('sources/config.py'): {50L: (0,
117
+                     loc('sources/config.py'): {51L: (0,
118 118
         None,
119 119
         1,
120
-        0)},
120
+        0),
121
+        106L: (0,
122
+               None,
123
+               1,
124
+               0),
125
+        114L: (0,
126
+               None,
127
+               1,
128
+               0)},
121 129
                      loc('sources/euronews.py'): {161L: (0,
122 130
         None,
123 131
         1,
@@ -256,7 +264,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
256 264
         'view': {'area': 'tall',
257 265
                  'constraint': None,
258 266
                  'current_pages': [0,
259
-                                   0],
267
+                                   2],
260 268
                  'full-screen': False,
261 269
                  'notebook_display': 'normal',
262 270
                  'notebook_percent': 0.17992831541218635,
@@ -824,7 +832,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
824 832
                                None)],
825 833
                  'primary_view_state': {'area': 'wide',
826 834
         'constraint': None,
827
-        'current_pages': [8,
835
+        'current_pages': [2,
828 836
                           0],
829 837
         'notebook_display': 'normal',
830 838
         'notebook_percent': 0.4761133603238866,
@@ -860,7 +868,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
860 868
                                        'fRegexFlags': 46,
861 869
                                        'fReplaceText': u'streams_file',
862 870
                                        'fReverse': False,
863
-                                       'fSearchText': u'stream_file',
871
+                                       'fSearchText': u'cfg_file',
864 872
                                        'fStartPos': 0,
865 873
                                        'fStyle': 'text',
866 874
                                        'fWholeWords': False,
@@ -873,7 +881,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
873 881
                                       'fReplaceOnDisk': False,
874 882
                                       'fShowFirstMatch': False,
875 883
                                       'fShowLineno': True,
876
-                                      'fShowReplaceWidgets': True}}),
884
+                                      'fShowReplaceWidgets': False}}),
877 885
                      ('batch-search',
878 886
                       'wide',
879 887
                       0,
@@ -934,7 +942,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
934 942
         -1,
935 943
         -1),
936 944
                        'attrib-starts': [],
937
-                       'first-line': 116L,
945
+                       'first-line': 123L,
938 946
                        'folded-linenos': [],
939 947
                        'history': {u'file:C:/Data/Programming/enigma2/PlayStream2/content/run.py': ['s'\
940 948
         'elf.cfg_file\n',
@@ -953,6 +961,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
953 961
         'self.lists\n',
954 962
         'if self.lists: print True\n',
955 963
         're.search("(https*|ftps*)://.*", self.stream_file)\n'],
964
+                                   u'file:C:/Data/Programming/enigma2/PlayStream2/content/sources/config.py': ['e'\
965
+        '\n',
966
+        'open(tmp_file, "r")\n'],
956 967
                                    u'file:C:/Data/Programming/enigma2/PlayStream2/content/sources/filmix.py': ['p'\
957 968
         'ath\n',
958 969
         'print translations\n',
@@ -972,10 +983,10 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
972 983
         's\n',
973 984
         'e\n']},
974 985
                        'launch-id': None,
975
-                       'sel-line': 128L,
976
-                       'sel-line-start': 9757L,
977
-                       'selection_end': 9757L,
978
-                       'selection_start': 9757L,
986
+                       'sel-line': 134L,
987
+                       'sel-line-start': 9986L,
988
+                       'selection_end': 9994L,
989
+                       'selection_start': 9994L,
979 990
                        'zoom': 0L}),
980 991
                      ('debug-watch',
981 992
                       'wide',
@@ -1012,173 +1023,167 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1012 1023
         -1,
1013 1024
         -1),
1014 1025
                        'attrib-starts': [],
1015
-                       'first-line': 0L,
1026
+                       'first-line': 30L,
1016 1027
                        'folded-linenos': [],
1017
-                       'history': {},
1028
+                       'history': {None: ['import StringIO\n',
1029
+        'a = StringIO.StringIO()\n',
1030
+        'a.write("aaa\\n")\n',
1031
+        'a.close()\n',
1032
+        'a.read()\n',
1033
+        'import urlparse\n',
1034
+        'urlparse.urlparse("ftp://user:Kaskade7@home.blue.lv/hdd/aaa.cfg")\n',
1035
+        'p = urlparse.urlparse("ftp://user:Kaskade7@home.blue.lv/hdd/aaa.cfg'\
1036
+        '")\n',
1037
+        'p\n',
1038
+        'p.password\n',
1039
+        'p.netloc\n',
1040
+        'p.hostname\n',
1041
+        'p.path\n',
1042
+        'p.user\n',
1043
+        'elif \n']},
1018 1044
                        'launch-id': None,
1019
-                       'sel-line': 2L,
1020
-                       'sel-line-start': 174L,
1021
-                       'selection_end': 174L,
1022
-                       'selection_start': 174L,
1045
+                       'sel-line': 42L,
1046
+                       'sel-line-start': 1384L,
1047
+                       'selection_end': 1384L,
1048
+                       'selection_start': 1384L,
1023 1049
                        'zoom': 0L})],
1024
-        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('sources/config.py'),
1025
-        {'attrib-starts': [('Source',
1026
-                            12),
1027
-                           ('Source.get_content',
1028
-                            28)],
1029
-         'first-line': 21L,
1050
+        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('run.py'),
1051
+        {'attrib-starts': [],
1052
+         'first-line': 713L,
1030 1053
          'folded-linenos': [],
1031
-         'sel-line': 30L,
1032
-         'sel-line-start': 1138L,
1033
-         'selection_end': 1163L,
1034
-         'selection_start': 1151L,
1054
+         'sel-line': 724L,
1055
+         'sel-line-start': 29166L,
1056
+         'selection_end': 29178L,
1057
+         'selection_start': 29170L,
1035 1058
          'zoom': 0L},
1036
-        1520692463.547],
1037
-        [loc('sources/config.py'),
1038
-         {'attrib-starts': [('Source',
1039
-                             12),
1040
-                            ('Source.read_streams',
1041
-                             40)],
1042
-          'first-line': 31L,
1059
+        1520694091.959],
1060
+        [loc('run.py'),
1061
+         {'attrib-starts': [('Main',
1062
+                             22),
1063
+                            ('Main.__init__',
1064
+                             24)],
1065
+          'first-line': 19L,
1043 1066
           'folded-linenos': [],
1044
-          'sel-line': 40L,
1045
-          'sel-line-start': 1381L,
1046
-          'selection_end': 1401L,
1047
-          'selection_start': 1389L,
1067
+          'sel-line': 24L,
1068
+          'sel-line-start': 554L,
1069
+          'selection_end': 594L,
1070
+          'selection_start': 586L,
1048 1071
           'zoom': 0L},
1049
-         1520692464.407],
1050
-        [loc('sources/config.py'),
1051
-         {'attrib-starts': [('Source',
1052
-                             12),
1053
-                            ('Source.__init__',
1054
-                             14)],
1055
-          'first-line': 21L,
1072
+         1520694093.213],
1073
+        [loc('run.py'),
1074
+         {'attrib-starts': [('Main',
1075
+                             22),
1076
+                            ('Main.__init__',
1077
+                             24)],
1078
+          'first-line': 28L,
1056 1079
           'folded-linenos': [],
1057
-          'sel-line': 26L,
1058
-          'sel-line-start': 1030L,
1059
-          'selection_end': 1055L,
1060
-          'selection_start': 1043L,
1080
+          'sel-line': 37L,
1081
+          'sel-line-start': 1125L,
1082
+          'selection_end': 1186L,
1083
+          'selection_start': 1178L,
1061 1084
           'zoom': 0L},
1062
-         1520692465.724],
1063
-        [loc('sources/config.py'),
1064
-         {'attrib-starts': [('Source',
1065
-                             12),
1066
-                            ('Source.get_content',
1067
-                             28)],
1068
-          'first-line': 21L,
1085
+         1520694094.015],
1086
+        [loc('run.py'),
1087
+         {'attrib-starts': [('run',
1088
+                             531)],
1089
+          'first-line': 522L,
1069 1090
           'folded-linenos': [],
1070
-          'sel-line': 30L,
1071
-          'sel-line-start': 1138L,
1072
-          'selection_end': 1163L,
1073
-          'selection_start': 1151L,
1091
+          'sel-line': 532L,
1092
+          'sel-line-start': 22109L,
1093
+          'selection_end': 22126L,
1094
+          'selection_start': 22126L,
1074 1095
           'zoom': 0L},
1075
-         1520692470.498],
1096
+         1520694103.129],
1076 1097
         [loc('run.py'),
1077
-         {'attrib-starts': [('VideoInfo',
1078
-                             343),
1079
-                            ('VideoInfo.apply',
1080
-                             526)],
1081
-          'first-line': 523L,
1098
+         {'attrib-starts': [('run',
1099
+                             531)],
1100
+          'first-line': 525L,
1082 1101
           'folded-linenos': [],
1083
-          'sel-line': 529L,
1084
-          'sel-line-start': 22022L,
1085
-          'selection_end': 22022L,
1086
-          'selection_start': 22022L,
1102
+          'sel-line': 532L,
1103
+          'sel-line-start': 22109L,
1104
+          'selection_end': 22141L,
1105
+          'selection_start': 22133L,
1087 1106
           'zoom': 0L},
1088
-         1520692477.372],
1089
-        [loc('sources/config.py'),
1090
-         {'attrib-starts': [('Source',
1091
-                             12),
1092
-                            ('Source.read_streams',
1093
-                             41)],
1094
-          'first-line': 44L,
1095
-          'folded-linenos': [44L,
1096
-                             58L],
1097
-          'sel-line': 53L,
1098
-          'sel-line-start': 2017L,
1099
-          'selection_end': 2030L,
1100
-          'selection_start': 2030L,
1107
+         1520694105.043],
1108
+        [loc('run.py'),
1109
+         {'attrib-starts': [('run',
1110
+                             531)],
1111
+          'first-line': 525L,
1112
+          'folded-linenos': [],
1113
+          'sel-line': 532L,
1114
+          'sel-line-start': 22109L,
1115
+          'selection_end': 22150L,
1116
+          'selection_start': 22142L,
1101 1117
           'zoom': 0L},
1102
-         1520692758.744],
1118
+         1520694105.709],
1103 1119
         [loc('run.py'),
1104
-         {'attrib-starts': [('VideoInfo',
1105
-                             343),
1106
-                            ('VideoInfo.apply',
1107
-                             526)],
1108
-          'first-line': 523L,
1120
+         {'attrib-starts': [('run_cli',
1121
+                             538)],
1122
+          'first-line': 531L,
1109 1123
           'folded-linenos': [],
1110
-          'sel-line': 529L,
1111
-          'sel-line-start': 22022L,
1112
-          'selection_end': 22022L,
1113
-          'selection_start': 22022L,
1124
+          'sel-line': 538L,
1125
+          'sel-line-start': 22221L,
1126
+          'selection_end': 22285L,
1127
+          'selection_start': 22277L,
1114 1128
           'zoom': 0L},
1115
-         1520692764.885],
1116
-        [loc('sources/config.py'),
1117
-         {'attrib-starts': [('Source',
1118
-                             12),
1119
-                            ('Source.__init__',
1120
-                             14)],
1121
-          'first-line': 17L,
1122
-          'folded-linenos': [58L],
1123
-          'sel-line': 26L,
1124
-          'sel-line-start': 1044L,
1125
-          'selection_end': 1060L,
1126
-          'selection_start': 1060L,
1129
+         1520694111.18],
1130
+        [loc('run.py'),
1131
+         {'attrib-starts': [],
1132
+          'first-line': 715L,
1133
+          'folded-linenos': [],
1134
+          'sel-line': 724L,
1135
+          'sel-line-start': 29166L,
1136
+          'selection_end': 29178L,
1137
+          'selection_start': 29170L,
1127 1138
           'zoom': 0L},
1128
-         1520692806.414],
1139
+         1520694112.068],
1129 1140
         [loc('run.py'),
1130
-         {'attrib-starts': [('VideoInfo',
1131
-                             343),
1132
-                            ('VideoInfo.apply',
1133
-                             526)],
1134
-          'first-line': 523L,
1141
+         {'attrib-starts': [],
1142
+          'first-line': 720L,
1135 1143
           'folded-linenos': [],
1136
-          'sel-line': 529L,
1137
-          'sel-line-start': 22022L,
1138
-          'selection_end': 22022L,
1139
-          'selection_start': 22022L,
1144
+          'sel-line': 727L,
1145
+          'sel-line-start': 29296L,
1146
+          'selection_end': 29327L,
1147
+          'selection_start': 29319L,
1140 1148
           'zoom': 0L},
1141
-         1520692811.456],
1142
-        [loc('sources/config.py'),
1143
-         {'attrib-starts': [('Source',
1144
-                             12),
1145
-                            ('Source.read_streams',
1146
-                             41)],
1147
-          'first-line': 52L,
1149
+         1520694113.128],
1150
+        [loc('run.py'),
1151
+         {'attrib-starts': [],
1152
+          'first-line': 720L,
1148 1153
           'folded-linenos': [],
1149
-          'sel-line': 60L,
1150
-          'sel-line-start': 2292L,
1151
-          'selection_end': 2292L,
1152
-          'selection_start': 2292L,
1154
+          'sel-line': 727L,
1155
+          'sel-line-start': 29296L,
1156
+          'selection_end': 29336L,
1157
+          'selection_start': 29328L,
1153 1158
           'zoom': 0L},
1154
-         1520692931.11],
1159
+         1520694113.917],
1155 1160
         [loc('run.py'),
1156
-         {'attrib-starts': [('VideoInfo',
1157
-                             343),
1158
-                            ('VideoInfo.apply',
1159
-                             526)],
1160
-          'first-line': 523L,
1161
+         {'attrib-starts': [('Main',
1162
+                             22),
1163
+                            ('Main.__init__',
1164
+                             24)],
1165
+          'first-line': 19L,
1161 1166
           'folded-linenos': [],
1162
-          'sel-line': 529L,
1163
-          'sel-line-start': 22022L,
1164
-          'selection_end': 22022L,
1165
-          'selection_start': 22022L,
1167
+          'sel-line': 33L,
1168
+          'sel-line-start': 1001L,
1169
+          'selection_end': 1018L,
1170
+          'selection_start': 1018L,
1166 1171
           'zoom': 0L},
1167
-         1520692945.834],
1168
-        [loc('sources/config.py'),
1169
-         {'attrib-starts': [('Source',
1170
-                             12),
1171
-                            ('Source.__init__',
1172
-                             14)],
1173
-          'first-line': 16L,
1172
+         1520694125.794],
1173
+        [loc('run.py'),
1174
+         {'attrib-starts': [('Main',
1175
+                             22),
1176
+                            ('Main.__init__',
1177
+                             24)],
1178
+          'first-line': 28L,
1174 1179
           'folded-linenos': [],
1175
-          'sel-line': 21L,
1176
-          'sel-line-start': 763L,
1177
-          'selection_end': 763L,
1178
-          'selection_start': 763L,
1180
+          'sel-line': 37L,
1181
+          'sel-line-start': 1125L,
1182
+          'selection_end': 1166L,
1183
+          'selection_start': 1152L,
1179 1184
           'zoom': 0L},
1180
-         1520693017.716],
1181
-        [loc('sources/config.py'),
1185
+         1520694143.184],
1186
+        [loc('ContentSources.py'),
1182 1187
          {'attrib-starts': [],
1183 1188
           'first-line': 0L,
1184 1189
           'folded-linenos': [],
@@ -1187,111 +1192,108 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1187 1192
           'selection_end': 21L,
1188 1193
           'selection_start': 21L,
1189 1194
           'zoom': 0L},
1190
-         1520693172.463],
1191
-        [loc('sources/config.py'),
1192
-         {'attrib-starts': [('Source',
1193
-                             12),
1194
-                            ('Source.__init__',
1195
-                             14)],
1195
+         1520694148.372],
1196
+        [loc('ContentSources.py'),
1197
+         {'attrib-starts': [('ContentSources',
1198
+                             16),
1199
+                            ('ContentSources.__init__',
1200
+                             20)],
1196 1201
           'first-line': 18L,
1197 1202
           'folded-linenos': [],
1198
-          'sel-line': 27L,
1199
-          'sel-line-start': 1070L,
1200
-          'selection_end': 1095L,
1201
-          'selection_start': 1083L,
1203
+          'sel-line': 20L,
1204
+          'sel-line-start': 703L,
1205
+          'selection_end': 747L,
1206
+          'selection_start': 739L,
1202 1207
           'zoom': 0L},
1203
-         1520693173.999],
1204
-        [loc('sources/config.py'),
1205
-         {'attrib-starts': [('Source',
1206
-                             12),
1207
-                            ('Source.get_content',
1208
-                             29)],
1209
-          'first-line': 24L,
1208
+         1520694152.882],
1209
+        [loc('ContentSources.py'),
1210
+         {'attrib-starts': [('ContentSources',
1211
+                             16),
1212
+                            ('ContentSources.__init__',
1213
+                             20)],
1214
+          'first-line': 28L,
1210 1215
           'folded-linenos': [],
1211
-          'sel-line': 31L,
1212
-          'sel-line-start': 1178L,
1213
-          'selection_end': 1203L,
1214
-          'selection_start': 1191L,
1216
+          'sel-line': 38L,
1217
+          'sel-line-start': 1556L,
1218
+          'selection_end': 1621L,
1219
+          'selection_start': 1613L,
1215 1220
           'zoom': 0L},
1216
-         1520693174.976],
1217
-        [loc('sources/config.py'),
1218
-         {'attrib-starts': [('Source',
1219
-                             12),
1220
-                            ('Source.read_streams',
1221
-                             41)],
1222
-          'first-line': 32L,
1221
+         1520694161.991],
1222
+        [loc('run.py'),
1223
+         {'attrib-starts': [('Main',
1224
+                             22),
1225
+                            ('Main.__init__',
1226
+                             24)],
1227
+          'first-line': 28L,
1223 1228
           'folded-linenos': [],
1224
-          'sel-line': 41L,
1225
-          'sel-line-start': 1421L,
1226
-          'selection_end': 1441L,
1227
-          'selection_start': 1429L,
1229
+          'sel-line': 35L,
1230
+          'sel-line-start': 1074L,
1231
+          'selection_end': 1102L,
1232
+          'selection_start': 1102L,
1228 1233
           'zoom': 0L},
1229
-         1520693175.767],
1234
+         1520694959.722],
1230 1235
         [loc('sources/config.py'),
1231 1236
          {'attrib-starts': [('Source',
1232 1237
                              12),
1233 1238
                             ('Source.__init__',
1234 1239
                              14)],
1235
-          'first-line': 14L,
1240
+          'first-line': 11L,
1236 1241
           'folded-linenos': [],
1237
-          'sel-line': 22L,
1238
-          'sel-line-start': 876L,
1239
-          'selection_end': 904L,
1240
-          'selection_start': 893L,
1242
+          'sel-line': 18L,
1243
+          'sel-line-start': 616L,
1244
+          'selection_end': 623L,
1245
+          'selection_start': 623L,
1241 1246
           'zoom': 0L},
1242
-         1520693189.768],
1247
+         1520697293.876],
1243 1248
         [loc('sources/config.py'),
1244
-         {'attrib-starts': [('Source',
1245
-                             12),
1246
-                            ('Source.read_streams',
1247
-                             41)],
1248
-          'first-line': 33L,
1249
+         {'attrib-starts': [],
1250
+          'first-line': 142L,
1249 1251
           'folded-linenos': [],
1250
-          'sel-line': 42L,
1251
-          'sel-line-start': 1452L,
1252
-          'selection_end': 1476L,
1253
-          'selection_start': 1476L,
1252
+          'sel-line': 151L,
1253
+          'sel-line-start': 5206L,
1254
+          'selection_end': 5206L,
1255
+          'selection_start': 5206L,
1254 1256
           'zoom': 0L},
1255
-         1520693202.442],
1256
-        [loc('run.py'),
1257
-         {'attrib-starts': [('VideoInfo',
1258
-                             343),
1259
-                            ('VideoInfo.apply',
1260
-                             526)],
1261
-          'first-line': 517L,
1257
+         1520699114.77],
1258
+        [loc('../../../../../Python27/Lib/ftplib.py'),
1259
+         {'attrib-starts': [('FTP',
1260
+                             78),
1261
+                            ('FTP.getresp',
1262
+                             213)],
1263
+          'first-line': 211L,
1262 1264
           'folded-linenos': [],
1263
-          'sel-line': 529L,
1264
-          'sel-line-start': 22022L,
1265
-          'selection_end': 22022L,
1266
-          'selection_start': 22022L,
1265
+          'sel-line': 223L,
1266
+          'sel-line-start': 7831L,
1267
+          'selection_end': 7831L,
1268
+          'selection_start': 7831L,
1267 1269
           'zoom': 0L},
1268
-         1520693245.985],
1270
+         1520699128.124],
1269 1271
         [loc('sources/config.py'),
1270 1272
          {'attrib-starts': [('Source',
1271 1273
                              12),
1272
-                            ('Source.read_streams',
1273
-                             41)],
1274
-          'first-line': 39L,
1274
+                            ('Source.replace_item',
1275
+                             143)],
1276
+          'first-line': 139L,
1275 1277
           'folded-linenos': [],
1276
-          'sel-line': 42L,
1277
-          'sel-line-start': 1452L,
1278
-          'selection_end': 1476L,
1279
-          'selection_start': 1476L,
1278
+          'sel-line': 143L,
1279
+          'sel-line-start': 4984L,
1280
+          'selection_end': 5003L,
1281
+          'selection_start': 5003L,
1280 1282
           'zoom': 0L},
1281
-         1520693266.767]],
1283
+         1520699141.454]],
1282 1284
         20),
1283
-        'current-loc': loc('run.py'),
1285
+        'current-loc': loc('sources/config.py'),
1284 1286
         'editor-state-list': [(loc('run.py'),
1285
-                               {'attrib-starts': [('VideoInfo',
1286
-        343),
1287
-        ('VideoInfo.apply',
1288
-         526)],
1289
-                                'first-line': 517L,
1287
+                               {'attrib-starts': [('Main',
1288
+        22),
1289
+        ('Main.__init__',
1290
+         24)],
1291
+                                'first-line': 28L,
1290 1292
                                 'folded-linenos': [],
1291
-                                'sel-line': 528L,
1292
-                                'sel-line-start': 22020L,
1293
-                                'selection_end': 22020L,
1294
-                                'selection_start': 22020L,
1293
+                                'sel-line': 35L,
1294
+                                'sel-line-start': 1074L,
1295
+                                'selection_end': 1102L,
1296
+                                'selection_start': 1102L,
1295 1297
                                 'zoom': 0L}),
1296 1298
                               (loc('util.py'),
1297 1299
                                {'attrib-starts': [('unescape',
@@ -1308,12 +1310,12 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1308 1310
         16),
1309 1311
         ('ContentSources.__init__',
1310 1312
          20)],
1311
-                                'first-line': 33L,
1313
+                                'first-line': 28L,
1312 1314
                                 'folded-linenos': [],
1313
-                                'sel-line': 37L,
1314
-                                'sel-line-start': 1506L,
1315
-                                'selection_end': 1538L,
1316
-                                'selection_start': 1538L,
1315
+                                'sel-line': 38L,
1316
+                                'sel-line-start': 1556L,
1317
+                                'selection_end': 1621L,
1318
+                                'selection_start': 1613L,
1317 1319
                                 'zoom': 0L}),
1318 1320
                               (loc('sources/ltc.py'),
1319 1321
                                {'attrib-starts': [('Source',
@@ -1413,14 +1415,26 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1413 1415
                               (loc('sources/config.py'),
1414 1416
                                {'attrib-starts': [('Source',
1415 1417
         12),
1416
-        ('Source.read_streams',
1417
-         41)],
1418
-                                'first-line': 39L,
1418
+        ('Source.write_streams',
1419
+         73)],
1420
+                                'first-line': 81L,
1421
+                                'folded-linenos': [],
1422
+                                'sel-line': 86L,
1423
+                                'sel-line-start': 3224L,
1424
+                                'selection_end': 3285L,
1425
+                                'selection_start': 3285L,
1426
+                                'zoom': 0L}),
1427
+                              (loc('../../../../../Python27/Lib/ftplib.py'),
1428
+                               {'attrib-starts': [('FTP',
1429
+        78),
1430
+        ('FTP.getresp',
1431
+         213)],
1432
+                                'first-line': 211L,
1419 1433
                                 'folded-linenos': [],
1420
-                                'sel-line': 42L,
1421
-                                'sel-line-start': 1452L,
1422
-                                'selection_end': 1476L,
1423
-                                'selection_start': 1476L,
1434
+                                'sel-line': 223L,
1435
+                                'sel-line-start': 7831L,
1436
+                                'selection_end': 7831L,
1437
+                                'selection_start': 7831L,
1424 1438
                                 'zoom': 0L})],
1425 1439
         'has-focus': True,
1426 1440
         'locked': False},
@@ -1436,7 +1450,8 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1436 1450
          loc('sources/euronews.py'),
1437 1451
          loc('resolver.py'),
1438 1452
          loc('resolvers/cloudsany.py'),
1439
-         loc('sources/config.py')]),
1453
+         loc('sources/config.py'),
1454
+         loc('../../../../../Python27/Lib/ftplib.py')]),
1440 1455
                                'open_files': [u'Downloader.py',
1441 1456
         u'resolver.py',
1442 1457
         u'resolvers/cloudsany.py',
@@ -1448,8 +1463,8 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1448 1463
         u'sources/filmix.py',
1449 1464
         u'util.py',
1450 1465
         u'ContentSources.py',
1451
-        u'sources/config.py',
1452
-        u'run.py']},
1466
+        u'run.py',
1467
+        u'sources/config.py']},
1453 1468
         'saved_notebook_display': None,
1454 1469
         'split_percents': {0: 0.42670046472327844},
1455 1470
         'splits': 2,
@@ -1464,8 +1479,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1464 1479
                          -1080,
1465 1480
                          1858,
1466 1481
                          1080)}]}
1467
-guimgr.recent-documents = [loc('run.py'),
1468
-                           loc('sources/config.py'),
1482
+guimgr.recent-documents = [loc('sources/config.py'),
1483
+                           loc('../../../../../Python27/Lib/ftplib.py'),
1484
+                           loc('run.py'),
1469 1485
                            loc('ContentSources.py'),
1470 1486
                            loc('util.py'),
1471 1487
                            loc('sources/filmix.py'),
@@ -1997,7 +2013,8 @@ proj.env-vars = {None: ('default',
1997 2013
                         [u''])}
1998 2014
 search.replace-history = [u'www.shortcut.lv',
1999 2015
                           u'shortcut.lv']
2000
-search.search-history = [u'read_streams',
2016
+search.search-history = [u'cfg_file',
2017
+                         u'read_streams',
2001 2018
                          u'read_stream',
2002 2019
                          u'confif_file',
2003 2020
                          u'confif_f',
@@ -2015,8 +2032,7 @@ search.search-history = [u'read_streams',
2015 2032
                          u'thumbnail',
2016 2033
                          u'http:',
2017 2034
                          u'www.lattelecom.tv',
2018
-                         u'http://www',
2019
-                         u'lattelecom.tv']
2035
+                         u'http://www']
2020 2036
 testing.stored-results = (1,
2021 2037
                           [],
2022 2038
                           {})

+ 43
- 14
sources/config.py View File

@@ -12,9 +12,10 @@ from SourceBase import SourceBase
12 12
 os.path.dirname(os.path.abspath(__file__))
13 13
 class Source(SourceBase):
14 14
 
15
-    def __init__(self,country="lv",cfg_path=None, cfg_file="streams.cfg"):
15
+    def __init__(self,country="lv",cfg_path=None, cfg_file=""):
16 16
         self.name = "config"
17 17
         self.country=country
18
+        if not cfg_file: cfg_file = "streams.cfg"
18 19
         cur_directory = os.path.dirname(os.path.abspath(__file__))
19 20
         if not cfg_path: cfg_path = cur_directory
20 21
         self.cfg_path = cfg_path
@@ -72,24 +73,47 @@ class Source(SourceBase):
72 73
         sf.close()
73 74
     def write_streams(self):
74 75
 
75
-        if re.search("(https*|ftps*)://.*", self.streams_file):
76
-            # TODO
77
-            pass
76
+        if re.search("ftps*://.*", self.streams_file):
77
+            mode = "ftp"
78
+        elif re.search("https*://.*", self.streams_file):
79
+            mode = "http"
80
+            print "Warning stream_file http upload no yet implemented"
81
+            return
82
+        else:
83
+            mode = "file"
78 84
 
79
-        else:  # Paraksts fails
85
+        if mode == "ftp":
86
+            import tempfile
87
+            f = tempfile.NamedTemporaryFile("w", delete=False)
88
+            tmp_file = f.name
89
+        else:  # Parasts fails
80 90
             try:
81 91
                 f = open(self.streams_file, "w")
82 92
             except Exception as e:
83 93
                 raise Exception("Can not open streams file %s" % self.streams_file)
84
-            for l in self.lists.keys():
85
-                f.write("[%s]\n"%l)
86
-                t = self.get_title(l)
87
-                if t<>l:
88
-                    f.write("%s\n"%t)
89
-                for item in self.lists[l]:
90
-                    f.write("%s|%s|%s|%s\n"%(item[0].replace("\n",""),item[1],item[2],item[3].replace("\n","\\n")))
91
-                f.write("\n")
92
-            f.close()
94
+
95
+        for l in self.lists.keys():
96
+            f.write("[%s]\n"%l)
97
+            t = self.get_title(l)
98
+            if t<>l:
99
+                f.write("%s\n"%t)
100
+            for item in self.lists[l]:
101
+                f.write("%s|%s|%s|%s\n"%(item[0].replace("\n",""),item[1],item[2],item[3].replace("\n","\\n")))
102
+            f.write("\n")
103
+        f.close()
104
+
105
+        if mode == "ftp":
106
+            import ftplib, urlparse
107
+            p = urlparse.urlparse(self.streams_file)
108
+            try:
109
+                ftp = ftplib.FTP(p.hostname)
110
+                ftp.login(p.username, p.password)
111
+                ftp.storbinary("STOR "+p.path, open(tmp_file, "r"))
112
+                ftp.close()
113
+            except Exception as e:
114
+                print e.message
115
+
116
+
93 117
 
94 118
     def get_lists(self):
95 119
         return self.lists.keys()
@@ -126,6 +150,11 @@ class Source(SourceBase):
126 150
 
127 151
 
128 152
 if __name__ == "__main__":
153
+
154
+    source = Source(cfg_file="ftp://user:Kaskade7@home.blue.lv/hdd/streams.cfg")
155
+    source.read_streams()
156
+    source.write_streams()
157
+    import sys
129 158
     sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
130 159
     import run
131 160
     source = Source()