Stop the current wardriving session.
(self)
| 1697 | imported_wifi = 0 |
| 1698 | imported_bt = 0 |
| 1699 | imported_cell = 0 |
| 1700 | skipped = 0 |
| 1701 | |
| 1702 | try: |
| 1703 | # Handle both file path and file-like objects |
| 1704 | if isinstance(csv_path_or_stream, str): |
| 1705 | fh = open(csv_path_or_stream, 'r', encoding='utf-8', errors='replace') |
| 1706 | else: |
| 1707 | fh = csv_path_or_stream |
| 1708 | |
| 1709 | lines = fh.readlines() |
| 1710 | if hasattr(csv_path_or_stream, 'close') and isinstance(csv_path_or_stream, str): |
| 1711 | fh.close() |
| 1712 | |
| 1713 | # Skip WiGLE metadata line(s) starting with WigleWifi |
| 1714 | data_lines = [] |
| 1715 | header_line = None |
| 1716 | for line in lines: |
| 1717 | stripped = line.strip() |
| 1718 | if stripped.lower().startswith('wigle') or stripped.lower().startswith('#'): |
| 1719 | continue |
| 1720 | if header_line is None: |
| 1721 | header_line = stripped |
| 1722 | continue |
| 1723 | data_lines.append(stripped) |
| 1724 | |
| 1725 | if not header_line: |
| 1726 | return {'error': 'No CSV header found', 'imported': 0} |