diff --git a/adstreme/glade/KeywordGenerator.py b/adstreme/KeywordGenerator/KeywordGenerator.py similarity index 100% rename from adstreme/glade/KeywordGenerator.py rename to adstreme/KeywordGenerator/KeywordGenerator.py diff --git a/adstreme/glade/filechooser.py b/adstreme/KeywordGenerator/filechooser.py similarity index 100% rename from adstreme/glade/filechooser.py rename to adstreme/KeywordGenerator/filechooser.py diff --git a/adstreme/glade/kg-frontend/kg-frontend.glade b/adstreme/KeywordGenerator/kg-frontend/kg-frontend.glade similarity index 100% rename from adstreme/glade/kg-frontend/kg-frontend.glade rename to adstreme/KeywordGenerator/kg-frontend/kg-frontend.glade diff --git a/adstreme/glade/kg-frontend/kg-frontend.gladep b/adstreme/KeywordGenerator/kg-frontend/kg-frontend.gladep similarity index 100% rename from adstreme/glade/kg-frontend/kg-frontend.gladep rename to adstreme/KeywordGenerator/kg-frontend/kg-frontend.gladep diff --git a/adstreme/glade/kg_calc.py b/adstreme/KeywordGenerator/kg_calc.py similarity index 100% rename from adstreme/glade/kg_calc.py rename to adstreme/KeywordGenerator/kg_calc.py diff --git a/adstreme/glade/kg_frontend.py b/adstreme/KeywordGenerator/kg_frontend.py similarity index 100% rename from adstreme/glade/kg_frontend.py rename to adstreme/KeywordGenerator/kg_frontend.py diff --git a/adstreme/README b/adstreme/README deleted file mode 100644 index c606e53..0000000 --- a/adstreme/README +++ /dev/null @@ -1,22 +0,0 @@ -This set of scripts hopefully evolve into a useful tool for creating and managing google adwords. - -First Goal: -- get three comma separated lists of keywords -- return: - a string containing a combination of keywords from list 1 and two with - every word from list. this combination is then printed either as-is or - with "" or []. - -Example of First Goal: - ./adstreme.py "organic" "shirts" ",buy,shop" - results in: - organic shirts - "organic shirts" - [organic shirts] - organic shirts buy - "organic shirts buy" - [organic shirts buy] - organic shirts shop - "organic shirts shop" - [organic shirts shop] - diff --git a/adstreme/keyword_generator.py b/adstreme/keyword_generator.py deleted file mode 100644 index cdf4fc1..0000000 --- a/adstreme/keyword_generator.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -#TODO: funktion, die aus parametern schoene listen macht. - -import string,sys - -def add_prefix_to_strings(prefix,stringlist): - """gets a string and a list of strings - returns a list of strings each prefixed with given string.""" - ret = [] - for item in stringlist: - ret.append(prefix+item) - return ret - -def quotes_and_braces(keywords): - """gets a string with keywords, returns - given string - "given string" - [given string] - """ - ret = '%s\n' % keywords - ret += '"%s"\n' % keywords - ret += '[%s]\n' % keywords - return ret - -def arg_string_to_list(s): - """gets a string. - removes all occurences of " and splits with , as separator.""" - s = s.replace('"','') - ret = s.split(',') - return ret - -def get_arguments(): - """ - returns command line arguments as 3 lists.""" - ret1 = [] - ret2 = [] - ret3 = [] - try: - ret1 = arg_string_to_list(sys.argv[1]) - except: - pass - try: - ret2 = arg_string_to_list(sys.argv[2]) - except: - pass - try: - ret3 = arg_string_to_list(sys.argv[3]) - except: - pass - - return (ret1,ret2,ret3) - -def generate_keywords(list1,list2,list3): - """ - gets 3 lists of keyword parts. - returns a string containing every possible combination of above - keywords and its generated variants from quotes_and_braces." - """ - ret = "" - for list1item in list1: - tmplist1 = [] - tmplist1 = add_prefix_to_strings(list1item+" ",list2) - for tmplist1item in tmplist1: - tmplist2 = [] - tmplist2 = add_prefix_to_strings(tmplist1item+" ",list3) - for tmplist2item in tmplist2: - ret += quotes_and_braces(tmplist2item) - ret += "\n\n" - return ret[:-3] #cut the tailing '\n\n\n' - - - -def test(): - #sample data - - - #test quotes_and_brace - keywords = "fair clothing" - expected_result = """fair clothing\n"fair clothing"\n[fair clothing]\n""" - if quotes_and_braces(keywords) != expected_result: - raise "test of quotes_and_braces() failed!" - - #test add_prefix_to_strings - pref = "fair " - strlist = ["clothing","clothings"] - expected_result = ["fair clothing","fair clothings"] - if add_prefix_to_strings(pref,strlist) != expected_result: - raise "test of add_prefix_to_strings() failed!" - - #test generate_keywords - list1 = ["fair"] - list2 = ["clothing","clothings"] - list3 = ["buy"] - expected_result = """fair clothing buy\n"fair clothing buy"\n[fair clothing buy]\n\n\nfair clothings buy\n"fair clothings buy"\n[fair clothings buy]\n\n\n""" - - if generate_keywords(list1,list2,list3) != expected_result: - raise "test of generate_keywords() failed!" - - #test arg_string_to_list(s) - s = '"clothing,clothings"' - expected_result = ['clothing', 'clothings'] - if arg_string_to_list(s) != expected_result: - raise "test of arg_string_to_list() failed!" - - #test get_arguments() - (list1,list2,list3) = get_arguments() - - -if __name__ == "__main__": - #test() - if len(sys.argv) !=4 : - print ' %s is a script for generating keyword lists suitable for google adwords.' % sys.argv[0] - print ' usage: %s "part1,alterative part1" "part2, another part2" ",verb"' % sys.argv[0] - else: - (list1,list2,list3) = get_arguments() - print generate_keywords(list1,list2,list3)